} // OutputUsers(IUserDeltaCollectionPage users) private IUserDeltaCollectionPage GetUsers(GraphServiceClient graphClient, object deltaLink) { IUserDeltaCollectionPage page; if (lastPage == null) { page = graphClient .Users .Delta() .Request() .GetAsync() .Result; } else { if (deltaLink == null) { return(null); } else { lastPage.InitializeNextPageRequest(graphClient, deltaLink.ToString()); page = lastPage.NextPageRequest.GetAsync().Result; } } lastPage = page; return(page); } // GetUsers(GraphServiceClient graphClient, object deltaLink)
private static IUserDeltaCollectionPage GetUsers(GraphServiceClient graphClient, object deltaLink) { IUserDeltaCollectionPage page; // IF this is the first request (previous=null), then request all users // and include Delta() to request a delta link to be included in the // last page of data if (_previousPage == null) { page = graphClient.Users .Delta() .Request() .Select("Id,GivenName,Surname") .GetAsync() .Result; } // ELSE, not the first page so get the next page of users else { _previousPage.InitializeNextPageRequest(graphClient, deltaLink.ToString()); page = _previousPage.NextPageRequest.GetAsync().Result; } _previousPage = page; return(page); }
private static IUserDeltaRequest GetNextDeltaRequest(IUserDeltaCollectionPage currentPage, IGraphServiceClient client) { string deltaLink = GetDeltaLinkFromPage(currentPage); currentPage.InitializeNextPageRequest(client, deltaLink); return(currentPage.NextPageRequest); }
private async Task <IUserDeltaCollectionPage> GetUsers(GraphServiceClient graphClient, object deltaLink) { IUserDeltaCollectionPage page; if (lastPage == null) { page = await graphClient.Users .Delta() .Request() .GetAsync(); } else { lastPage.InitializeNextPageRequest(graphClient, deltaLink.ToString()); page = await lastPage.NextPageRequest.GetAsync(); } lastPage = page; return(page); }