Share via

Not getting next Link

Ankur Shah 66 Reputation points
2022-04-19T09:40:29.113+00:00

Hi, I am using below code to retrieve messages but not getting nextLink to retrieve more content.

graphClient .users("userEmailId") .messages().buildRequest().get();

Microsoft Security | Microsoft Graph
0 comments No comments

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,456 Reputation points
    2022-04-20T09:29:21.45+00:00

    Hi @Ankur Shah

    The @odata.nextLink doesn't appear by default in your results, you need to customize the pagination entry, refer to a similar question.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


  2. Shivam Dhiman 6,086 Reputation points
    2022-04-19T12:00:34.643+00:00

    Hi @Ankur Shah

    This can be due to the page size. As per documentation default page size is 10 messages so if less number of messages are present you will not get @odata.nextLink.
    194311-odatanext2.png

    I would suggest you to use $top along with your query. This will help you to set the page size of result.

    GET https://graph.microsoft.com/v1.0/me/messages?$top=2  
    

    You can also use delta query. This allows you to maintain and synchronize a local store of a user's entire set of messages.

    GET https://graph.microsoft.com/v1.0/me/mailFolders/{id}/messages/delta  
    

    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".

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.