0

I'm using the following code

const users: MSGraphClient = this.context.serviceScope.consume(MSGraphClient.serviceKey);

users
  .api("/users")
  .select("displayName,mobilePhone,mail,photo,department,jobTitle,mailNickname,loginName")
  .top(10)
  .get((error, response: any, rawResponse?: any) => {

Since I'm using .top(10) and have more user than 10 I automatic get @odata.nextLink and that contains the url to get the next 10 people.

More documentaion is found here

But I'm unable to find a way that I'm allowed to call/use the url.

In the documentaion it states: You can retrieve the next page of results by sending the URL value of the @odata:nextLink property to Microsoft Graph.

Can anyone tell me how I can do the above statement?

1 Answer 1

1

If you send a request to the "@odata.nextLink" URL, you will have the next 10 users. It has the parameters in the URL... try something like (only to test it i wouldnt let like that and i wouldn't call MSGraphClient var as "users"):

    const users: MSGraphClient = this.context.serviceScope.consume(MSGraphClient.serviceKey);

    users
        .api("/users")
        .select("displayName,mobilePhone,mail,photo,department,jobTitle,mailNickname,loginName")
        .top(10)
        .get((error, response: any, rawResponse?: any) => {

            users.api(response[@odata:nextLink]).get((error2,response2: any, rawResponse?: any) => {
                // do stuff
            });
        });

I am not sure if you need to remove the https://graph.microsoft.com/v1.0 from string response[@odata:nextLink]...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.