Search code examples
microsoft-graph-apimicrosoft-todo

Create ToDo-Tasks for other users


Is it possible to create a ToDo-Task for other users using a single Admin login?

I have registered an app, and set "API permissions" for Tasks.Read, Tasks.ReadWrite, User.Read.All api permissions

I have two users. An admin user, and a test user.
I acquire an access_token for the admin user:

rest call to acquire admin's access_token

Using the admin's access token as Auth Header "Bearer {{token}}", I can read the test user's profile with GET https://graph.microsoft.com/v1.0/users/testuser@mycompany.onmicrosoft.com

I can successfully create a ToDo-Task for the test user using the test user's access token.
I can successfully create a ToDo-Task for the admin user using the admin user's access token.
However, if I try to create a ToDo-Task for the test user with the admin's access token, I receive this error message ({{ListID}} = List-ID of the test user): rest request to create task for testuser

{
    "error": {
        "code": "invalidRequest",
        "message": "Invalid request",
        "innerError": {
            "code": "ErrorIncorrectRoutingHint",
            "date": "2022-07-28T07:49:25",
            "request-id": "#######-####-####-####-############",
            "client-request-id": "########-####-####-####-############"
        }
    }
}

Solution

  • What you need is application permission, however, Graph ToDo tasks API is not yet supported. enter image description here

    For more information, check document:https://learn.microsoft.com/en-us/graph/api/resources/todo-overview?view=graph-rest-1.0