Esempio n. 1
0
        public static async Task <string> GetGroups(GraphServiceClient client, string deltaLink, ITargetBlock <Group> target, CancellationToken token)
        {
            IGroupDeltaCollectionPage page = new GroupDeltaCollectionPage();

            page.InitializeNextPageRequest(client, deltaLink);
            return(await GetGroups(page, target, token));
        }
        public static async Task <List <Group> > GetGroupsAsync(GraphServiceClient graphClient, HttpContext httpContext)
        {
            IGroupDeltaCollectionPage groupsPage = new GroupDeltaCollectionPage();

            groupsPage.InitializeNextPageRequest(
                graphClient,
                graphClient.
                Groups.
                Delta().
                Request().
                Select("Id,displayName").
                RequestUrl);

            var pageRequestCount = 0;
            var groups           = new List <Group>();

            do
            {
                groupsPage = await groupsPage.NextPageRequest.GetAsync(CancellationToken.None);

                groupsPage.ForEach(_ => groups.Add(_));
                pageRequestCount++;
            }while (groupsPage.NextPageRequest != null && pageRequestCount < _maxPageRequestsPerTenant);

            return(groups);
        }