Search code examples
office365ews-managed-apioffice365-appsoffice365api

How Create Tasks for other users via O365 API/Exchange Managed APi


The scenario

I am developing a Sharepoint provider hosted app. The Sharepoint app web is only used as a repository for storing items and The web application use O365 multitenant app to authenticate users by using ADAL Tokens.

The requirement I have is when a user create an item in the web application he/she can assign other users as responsible parties to that item. I need to create o365 tasks for the relevant users (i.e. users should be in same o365 tenant) to work as reminders.

Question 1:

I have searched about an o365 Task API to create tasks. Most of the results I found indicate that it is still not included in O365 Unified API. Does anyone know will it be released soon?

Question 2:

I used Exchange Web Services (i.e. EWS) Managed API (with the “OAuth token” of the user) to create tasks and retrieve them. This requires delegate permission "Access mailboxes as the signed-in user via Exc" in the azure AD app.

But the problem is with the EWS Managed API I can only create tasks for the signed in user. I couldn’t find a way to create tasks for other users.

Is there any way to create tasks for other users using aforementioned API?

When digging deeper I found out that in O365 there is a way to get “app only token”. But it’s not an option because it will grant access to all the Mailboxes in the O365 Tenant which will not be feasible since my app will be a 3rd party app that can be purchased from the app store.

If anyone can shed some light on these two questions it will highly appreciated.

Thank you.


Solution

  • Question 1: The REST APIs don't support tasks. I'd recommend posting a suggestion on UserVoice for this.

    Question 2: EWS doesn't support assigning tasks to other users. You would need to create the tasks in the "assigned" user's Task folder. That would require that the signed-in user have delegate access to the assigned user's Task folder, or you'd need to consider using an app-only token to get access to all users' mailboxes.