Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
Graph C++
>
Tutorial
> Create TodoTask
The following example creates a TodoTask in the specified task list.
C++ example
#include
#include
#include "independentsoft/graph/graph_client.hpp" #include "independentsoft/graph/graph_exception.hpp" #include "independentsoft/graph/item_body.hpp" #include "independentsoft/graph/content_type.hpp" #include "independentsoft/graph/todo/todo_task_list.hpp" #include "independentsoft/graph/todo/todo_task.hpp" using namespace independentsoft::graph; using namespace independentsoft::graph::todo; int main() { try { GraphClient client; client.client_id = "63333333-209e-454e-b7bd-55a4d201270f"; client.tenant = "independentsoft.onmicrosoft.com"; client.username = "info@independentsoft.onmicrosoft.com"; client.password = "password"; std::vector
todoTaskLists = sync_wait(client.get_todo_task_lists()); for (const TodoTaskList& list : todoTaskLists) { if (list.display_name == "Tasks") { TodoTask newTask; newTask.title = "New Task"; newTask.body = ItemBody("Body text", ContentType::Text); TodoTask createdTodoTask = sync_wait(client.create_todo_task(list.id, newTask)); } } } catch (const GraphException& ex) { std::cout << "Error: " << ex.code << std::endl; std::cout << "Message: " << ex.message << std::endl; } return 0; }
Need help? Ask our developers:
Name*
Email*
Message*