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)); }
public static async Task <string> GetUsersWithDelta(GraphServiceClient client, ITargetBlock <User> target, CancellationToken token, params string[] selectProperties) { var request = client.Users.Delta().Request().Select(string.Join(",", selectProperties)); return(await GraphHelperUsers.GetUsersWithDelta(request, target, token)); }