Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Fetching 999 records in subsequent (Next page) call.

$
0
0

I am using Graph Client 2.0.8 and fetching users. My tenant has more that 10K Users.

Problem : I am using Graph Client 2.0.8 and want to bring 5000 users. In Graph client I have specified each time bring 999, but Api only bring 999 records first time and then it bring only 100 records. However, I have specified 999 records in next page request as well.  Here is code snippet

 

   ActiveDirectoryClient graphConn = GraphServiceHelper.GetGraphConnection(TenantDomain, UserAccessToken, TraceId);
            userCollection = graphConn.Users;
   
   users = await userCollection.Take(ResultBatchSize).ExecuteAsync();
   
     if (users != null)
            {
                do
                {
                    // Convert User to UserModel DTO
                    var usersListModel = users.CurrentPage.Take(999).ToList();
                    isMoreRecordsAvailable = users.MorePagesAvailable;
                    if (usersListModel.Count() >= 5000 || !users.MorePagesAvailable) // exit if batch sized reach.
                        break;
                    else
                        users = await users.GetNextPageAsync();

                } while (true);
            }

How to bring 999 records in each subsequent call? Appreciate your help.


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>