Isuru
Isuru

Reputation: 968

List and create tasks for other users in Graph API

We have a company account associated to a subscription in Azure. As per this Microsoft documentation(https://learn.microsoft.com/en-us/graph/api/outlookuser-post-tasks?view=graph-rest-beta&tabs=csharp) that account comes under delegated permission type. We need to list other users outlook tasks and create tasks for other users using this company account. We are trying to use Graph API Beta version for this. We are able to perform these operations for signed in user's own tasks. But could not find a way to perform these operation for other users using the above company account.

Is this possible at this moment with Graph API Beta version? If so how to proceed? Otherwise what are the alternatives which fulfills the above requirement?

Upvotes: 2

Views: 1271

Answers (2)

Ivan Franjic
Ivan Franjic

Reputation: 151

What you need is application permission, however, Graph OutlookTask API is not yet supported.

OutlookTaskAPI Permissions

Edit: As of today (6/17/2020), it is still not supported. However, there is a request on Microsoft UserVoice.

https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests/suggestions/20160895-add-permissions-tasks-read-all-or-tasks-readwrite

Upvotes: 2

Allen Wu
Allen Wu

Reputation: 16498

We cannot use POST /users/{id|userPrincipalName}/outlook/tasks directly to create tasks for others. It will return an error "A folder id must be specified for delegate access."

Based on my test, there is indeed a way to do it. But in fact this is not a recommended way because of the huge workload.

We assume that you need use UserA to create outlook tasks for UserB.

Detailed steps:

  1. UserB gives mailbox permissions "Full Access" to UserA in Office 365. See Use the EAC to assign permissions to individual mailboxes. (Please note that UserA will be able to open UserB's mailbox and have all the permission of it after step 1. And the process can take up to hours for the changes to propagate through the system and be in effect.)
  2. Log in to Graph Explorer with UserA. List UserB's taskfolders by using Get https://graph.microsoft.com/beta/users/UserB/outlook/taskfolders. Record the "id" value, which will be used in the next step. (If you see an error like "The specified object was not found in the store.", please wait until step 1 take effect.)
  3. Create a task by using Post https://graph.microsoft.com/beta/users/UserB/outlook/taskfolders/{ID from step 2}/tasks.

enter image description here

Upvotes: 4

Related Questions