public static async Task <string> GetUsersWithDelta(GraphServiceClient client, string deltaLink, ITargetBlock <User> target, CancellationToken token)
        {
            IUserDeltaCollectionPage page = new UserDeltaCollectionPage();

            page.InitializeNextPageRequest(client, deltaLink);
            return(await GraphHelperUsers.GetUsersWithDelta(page, target, token));
        }
        private async Task ProduceObjects(ITargetBlock <User> target)
        {
            string newDeltaLink = null;

            if (this.context.InDelta)
            {
                if (!this.context.IncomingWatermark.Contains("user"))
                {
                    throw new WarningNoWatermarkException();
                }

                Watermark watermark = this.context.IncomingWatermark["user"];

                if (watermark.Value == null)
                {
                    throw new WarningNoWatermarkException();
                }

                newDeltaLink = await GraphHelperUsers.GetUsersWithDelta(this.client, watermark.Value, target, this.token);
            }
            else
            {
                //await GraphHelperUsers.GetUsers(client, target, context.Token, "displayName", "onPremisesSamAccountName", "id", "userPrincipalName");
                newDeltaLink = await GraphHelperUsers.GetUsersWithDelta(this.client, target, this.token, "displayName", "onPremisesSamAccountName", "id", "userPrincipalName");
            }

            if (newDeltaLink != null)
            {
                logger.Trace($"Got delta link {newDeltaLink}");
                this.context.OutgoingWatermark.Add(new Watermark("user", newDeltaLink, "string"));
            }

            target.Complete();
        }
        private static async Task <string> GetUsersWithDelta(IUserDeltaRequest request, ITargetBlock <User> target, CancellationToken token)
        {
            var page = await GraphHelper.ExecuteWithRetryAndRateLimit(async() => await request.GetAsync(token), token, 0);

            foreach (User user in page.CurrentPage)
            {
                target.Post(user);
            }

            return(await GraphHelperUsers.GetUsersWithDelta(page, target, token));
        }
Ejemplo n.º 4
0
        private async Task BuildGuestList(CancellationToken token)
        {
            int count = 0;

            if (!MicrosoftTeamsMAConfigSection.Configuration.ManageGuests)
            {
                var result = await GraphHelperUsers.GetGuestUsers(this.client, token);

                foreach (var item in result)
                {
                    this.usersToIgnore.Add(item);
                    count++;
                }
            }

            if (count > 0)
            {
                logger.Trace($"Added {count} guest users to the ignore list");
            }
        }
 public static async Task GetUsers(GraphServiceClient client, ITargetBlock <User> target, CancellationToken token, params string[] selectProperties)
 {
     var request = client.Users.Request().Select(string.Join(",", selectProperties));
     await GraphHelperUsers.GetUsers(request, target, token);
 }