Azure / Microsoft365R

R SDK for interacting with Microsoft 365 APIs
Other
311 stars 43 forks source link

Outlook - tasks (todo) #52

Open jaleds opened 3 years ago

jaleds commented 3 years ago

Very nice work for Outlook with emails :-)

Any ideas of how to get access to tasks (todos) from Outlook?

As I understand the same data that is stored as tasks in Outlook Exchange server can also be found in the new todo app, refer to using-microsoft-to-do-with-outlook-tasks

First attempt is to access the data using Outlook API to get tasks - however as I read - this is deprecated, task-rest-operation

The way forward might be to use the new todo-concept, refer to todo-concept-overview as the same data is stored at the exchange server and using the same credentials.

However, I cannot figure out how to use the API graph to access the todos.

hongooi73 commented 3 years ago

To work with tasks, you need to have the "Tasks.readwrite" permission. This isn't set for the app registration that Microsoft365R uses, or any of the alternatives mentioned in #5.

If you want to play around with the todo API, you can try something like this.

perms <- c("user.read", "files.readwrite", "groups.readwrite.all", "tasks.readwrite")
perms <- paste0("https://graph.microsoft.com/", perms)
token <- AzureAuth::get_azure_token(
  c(perms, "openid", "offline_access"),
  tenant="yourtenant",  # or "consumers" for your personal account
  app=Microsoft365R:::.microsoft365r_app_id
)

gr <- AzureGraph::ms_graph$new(token=token)
me <- gr$get_user()

me$do_operation("todo/lists")