Microsoft Graph ListMessages API not providing the emails

Viewed 41

I am currently using Microsoft Graph API v1 to retrieve the list of messages present in a user's inbox and I have all the necessary scopes listed in order to read and write messages on behalf of the user, the scopes are

An example code of what I am doing is as follows

function getUserMessages() {
   const baseUrl = "https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages";
   return axios({
          method: 'GET',
          url: baseUrl,
          headers:{
             "Authorization": "Bearer <access_token>"
             }
          }).then((result) => result.data);
}

// Here in the messages I get, I don't see some of the mails which are 
// present in the inbox Folder
const messages = getUserMessages();

1 Answers

Graph pages the returned messages. You can specify $top and $skip query parameters (in addition to $orderBy). It also returns @odata.nextLink value in JSON response that you can use to request the next page.

Related