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

Using paging in graph client 2.0

$
0
0

Currently, We are supporting 20K users in active directory. Our target to support 500-700K users. We are planning to change the paging in our Web UI and will load only 100 users in 5 pages first time with page size 20.

Problem : Suppose users clicks on 50<sup>th</sup> page, then We need to skip 50x20 = 1000 records and take next 100 records. When I am using Skip in Graph Client 2.0, it throw exception saying “Operation is not supported”.

If we go with paging, then I have to iterate through each page to find the next set of records, Which I don’t want to do that.

Question : What is best solutions to implement paging to support 500-700K users in Active directory.

Code  :

graphConn =GraphServiceHelper.GetGraphConnection(TenantDomain, UserAccessToken, TraceId);

               IPagedCollection<NewGraphClient.IUser> users = null;

               List<NewGraphClient.IUser> userList = null;

               users = await graphConn.Users.ExecuteAsync();

               if (users !=null)

               {

                   do

                   {

                       userList = users.CurrentPage.ToList();

                       // Do some operations

                       users = await users.GetNextPageAsync();

                   } while (users !=null);

               }

Thanks,

Sanjay Singh


Viewing all articles
Browse latest Browse all 16000

Trending Articles



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