How to get skipToken from deltaLink?

persistent_test 91 Reputation points
2022-04-27T13:01:49.007+00:00

graphClient
.users("userId").mailFolders(folder.id)
.messages().delta()
.buildRequest()
.get();

After this we get deltaLink, How will I take skipToken out of it and call the next set of messages?

Microsoft Graph SDK
Microsoft Graph SDK
A Microsoft software developer kit designed to simplify building high-quality, efficient, and resilient applications that access Microsoft Graph.
891 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman 5,771 Reputation points
    2022-04-27T14:27:52.81+00:00

    Hi @persistent_test

    Whenever you use delta link microsoft Graph sends a response containing the requested resource and a state token.
    You will get skiptoken or nextLink only if response has additional data i.e as per documentation.

    • If a nextLink(skipToken) URL is returned, there may be additional pages of data to be retrieved in the session. The application continues making requests using the nextLink URL to retrieve all pages of data until a deltaLink URL is returned in the response.
    • If a deltaLink URL is returned, there is no more data about the existing state of the resource to be returned. For future requests, the application uses the deltaLink URL to learn about changes to the resource.

    A delta query GET response always includes a URL specified in a nextLink or deltaLink response header. The nextLink URL includes a skipToken, and a deltaLink URL includes a deltaToken.

    Hope this helps.

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

    0 comments No comments