title: Microsoft Graph API Pagination is not working for getting all users from Azure AD
body: <p>We are using <strong>Microsoft Graph API Beta version</strong> to retrieve all users from the Azure AD using below code. API returns only 100 users in the response and to use paginated response we tried <code>NextPageRequest</code> property. But it always return <code>null</code> for the <code>NextPageRequest</code> property. And due to that it never enters to the while loop to retrieve rest of the users.</p>
  <p>Beta SDK version: 4.0.1.0</p>
  <p>Code:</p>
  <pre><code>                List&lt;User&gt; usersList = new List&lt;User&gt;();
                  IGraphServiceUsersCollectionPage users = await graphClient.Users.Request().GetAsync();
  
                  // Add the first page of results to the user list
                  usersList.AddRange(users.CurrentPage);
  
                  // Fetch each page and add those results to the list
                  while (users.NextPageRequest != null)
                  {
                      users = await users.NextPageRequest.GetAsync();
                      usersList.AddRange(users.CurrentPage);
                  }
  
                  log.Info(&quot;Users count: &quot; + usersList.Count.ToString());
                  return usersList;
  </code></pre>
  <p>Reference links that I followed:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/56707404/microsoft-graph-only-returning-the-first-100-users/56707771">Microsoft Graph only returning the first 100 Users</a></li>
  <li><a href="https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&amp;tabs=csharp" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&amp;tabs=csharp</a></li>
  </ul>
  <p>Any help on this will be appreciated!</p>