Microsoft Graph API nextLink throws an exception

Dawid Wysocki 1 Reputation point

I'm using Microsoft Graph Explorer to query a Sharepoint site. I'm applying a search using a desired document name.

The base query looks like this:{mysite},{siteid}/drive/root:/{rootpath}:/'searchphrase')

The query works fine, returning some results. There's @odata.nextLink, which also works fine, returning some another results.

But the second @odata.nextLink returns

{ "error": { "code": "generalException", "message": "General exception while processing", "innerError": { "date": "2022-04-20T08:40:12", "request-id": "cc7d19b5-49c8-49ea-a0ea-1ff745035fa9", "client-request-id": "c8a9436d-dced-c9c4-653f-e3dcd040e688" } } }

The failing @odata.nextLink looks like this:{mysite},{siteid}/drive/root:/{rootpath}:/'searchphrase')?$skiptoken=s!NDAwOzBmNTU2OWY0LTYxNjUtNDI5Mi1iZDAwLTNmZjk2Yzg3OWQwNQ

It fails for both v1.0 and beta. It worked fine a week ago - unfortunately can't say exactly when.
Sharepoint documents are added/updated daily.
Is it possible that the Sharepoint data causes the exception (like a file with a too long name, webUrl, et cetera)? Can I verify it somehow?
I assume that it might be the cause, because I can access many nextLinks if I apply $top=10, but the first nextLink throws general exception if I apply $top=100000

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,345 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,796 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,711 Reputation points Microsoft Vendor

    Hi @Dawid Wysocki ,

    There is no upper limit for SharePoint or OneDrive items. A reasonable page size is 200. A larger page size generally incurs higher latency.

    So when used $top=100000, operation failed with 500 Internal Server Error.

    Reference documents:

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments

  2. Dawid Wysocki 1 Reputation point

    Hi @Zehui Yao_MSFT @SrinivasaRaoDarnaMSFT-7657

    Thank you for your messages.

    I was a little unclear in my previous messages. The queries with $top specified were kind of a test I performed to see if $top will resolve my problems. By default, I do not use $top at all.

    I performed some tests again. Nothing works properly. A first execution of a query always works (without $skiptoken), but there are problems with @odata.NextLink

    1. No $top
      1.1. The query below works{mysite},{siteid}/drive/root:/{rootpath}:/'searchphrase')
      1.2. then returned @odata.NextLink does not work{mysite},{siteid}/drive/root:/{rootpath}:/'searchphrase')?$skiptoken=s!MjAwO2NhNTRkOTEyLTJiYTktNGQ3OS05OTA3LTBlZWJlMGRhNzA2MA
    2. $top specified. depending on $top value, @odata.nextLink also throws. it depends on the top value.
      2.1.with $top=200, 1st @odata.nextLink throws
      2.2. with $top=100, 1st @odata.nextLink throws
      2.2. with $top=50, 2nd @odata.nextLink throws
      2.3. with $top=30, 2nd @odata.nextLink throws
      2.4. with $top=20 things get weird. I performed few tests and a page that throws exception is always different. I performed 6 tests and @odata.NextLink that threw was accordingly: 2nd, 13th, 2nd, 6th, 18th, 14th.

    To be clear: when I say that e 2nd @odata.nextLink throws, it means that query for a third page threw an exception.

    I'd really appreciate any further investigation, this is a real bummer for us =(

  3. Alexander Suter 6 Reputation points

    Hello I've the same problem.

    I'm reading all transitiveMembers of a specifc user:$top=1

    then I get the $nextLink back and when I call the $nextLink it won't work!


    statusCode: 400

    {"error":{"code":"Request_UnsupportedQuery","message":"Invalid search request.","innerError":{"date":"2022-09-14T15:16:13","request-id":"e49d9ded-87ce-4219-80c8-b7f41a7eac2c","client-request-id":"e49d9ded-87ce-4219-80c8-b7f41a7eac2c"}}}

    0 comments No comments

  4. Alexander Suter 6 Reputation points

    is this a bug in microsoft graph?