Microsoft Graph me/messages returning incorrect @odata.nextLink $skip value

Dan Wahlin 21 Reputation points Microsoft Employee

I'm working on some Microsoft Graph messaging code that targets .NET Core. It uses Me.Messages and skips through 5 messages at a time using $top and $skip. Everything works great until I get to the end of the messages and then I get a really strange issue with $skip.

After paging through the first few pages the $skip value jumps from 25 (there are records available with that value) to 191 (apparently when it's out of messages) rather than setting NextPageRequest to null or something along those lines (not passing back a @odata.nextLink value). The image below makes it more clear.


Any reason why the $skip value would jump from 25 to 191? If I set $skip to something like 30, 50, or 100 I just get the 5 records that $skip=25 would give me. If I set $skip=190 I get the last record shown when $skip=25 is set. I'm confused by it at this point. The code I'm using can be found here:

Something similar to this can also be emulated directly in Graph Explorer with the default account:


I'm not sure if I'm missing how this is supposed to work or if the API isn't returning correct values for @odata.nextLink $skip.

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

1 answer

Sort by: Most helpful
  1. Waldek Mastykarz 1 Reputation point Microsoft Employee

    This behavior is intentional. There are other elements stored in the mailbox that need to be skipped which is why the skip value isn't continuous. The recommendation is to use the value from the nextLink as-is and not construct skip links manually.