Microsoft.Graph Todo API only returns 10 tasks

Femi 6 Reputation points
2021-02-12T07:55:44.68+00:00

I have been trying to use the Microsoft Graph API to see all of the tasks I created in the Todo App on another React Application. I used the react-aad-msal package to help with the connection. Everything has been working so far until I realized that it always returns only the 10 most recent tasks on the list despite there being more than 10 tasks in the list. I was wondering whether this was intended or whether I'm doing something wrong. I did not find anyone else having this issue on the GitHub repository of the package I'm using, so I turned to here.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,519 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Marc Rochel 6 Reputation points
    2021-06-03T15:00:27.95+00:00

    Hi !

    While the nextlink info is helpful, there is some similar issue I face:

    When I do

    https://graph.microsoft.com/v1.0/me/todo/lists

    I get a result of 15 task lists. However, there is no nextlink in the result like in your example. Trying to add ?$skip=10 to the request does not do anything. I get the same 15 lists returned.

    I can add ?$top=10000, that way I get 79 results. However, I have 114 task lists in my ms todo list app and the result set still does not contain a nextlink entry.

    When I list the tasks in a task list, I get 10 entries and a nextlink in the result. So something is odd with the task lists. How can I fix this?

    FYI: This behaviour is not just present in my code. It behaves exactly like this in Graph Explorer as well:

    {
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('XXXXXXXXXXXXX')/todo/lists",
    "value": [
    {
    "@odata.etag": "DFERGHSDFHSTRNSERGVB",
    "displayName": "Groceries speziell",
    "isOwner": false,
    "isShared": true,
    "wellknownListName": "none",
    "id": "DFGDTHERGSDFGDFDFGSDFGHERGHEFGDF"
    },
    {
    "@odata.etag": "DFGHERHNFBBHHSDFGHSDF
    :
    :
    as you can see, no nextlink. This is copy and paste from graph explorer with some ids replaced. The query was

    me/todo/lists

    1 person found this answer helpful.

  2. Bhakti Gaonkar 1 Reputation point
    2021-03-15T07:35:44.607+00:00

    The response contains nextlink, if the task list contains more than 10 tasks as shown in below image.
    77678-image.png

    Please refer to https://learn.microsoft.com/en-us/graph/paging to understand how to handle the nextlink