in src/PowerShell/Commands/GetPartnerUserSignInActivity.cs [218:257]
private async Task ParseBatchResponseAsync(IGraphServiceClient client, BatchRequestContent batchRequestContent, BatchResponseContent batchResponseContent, List<SignIn> signIns, int retryCount = 0)
{
AuditLogRootRestrictedSignInsCollectionResponse collection;
Dictionary<string, HttpResponseMessage> responses;
client.AssertNotNull(nameof(client));
batchRequestContent.AssertNotNull(nameof(batchRequestContent));
batchResponseContent.AssertNotNull(nameof(batchResponseContent));
signIns.AssertNotNull(nameof(signIns));
responses = await batchResponseContent.GetResponsesAsync().ConfigureAwait(false);
foreach (KeyValuePair<string, HttpResponseMessage> item in responses.Where(item => item.Value.IsSuccessStatusCode))
{
collection = await batchResponseContent
.GetResponseByIdAsync<AuditLogRootRestrictedSignInsCollectionResponse>(item.Key).ConfigureAwait(false);
collection.AdditionalData.TryGetValue("@odata.nextLink", out object nextPageLink);
string nextPageLinkString = nextPageLink as string;
if (!string.IsNullOrEmpty(nextPageLinkString))
{
collection.Value.InitializeNextPageRequest(client, nextPageLinkString);
}
if (collection.Value.NextPageRequest != null)
{
PagedRequests.Enqueue(collection.Value.NextPageRequest);
}
signIns.AddRange(collection.Value);
}
if (PagedRequests.Count >= 5)
{
await ProcessPagedRequestsAsync(client, signIns).ConfigureAwait(false);
}
await RetryRequestWithTransientFaultAsync(client, batchRequestContent, responses, signIns, ++retryCount).ConfigureAwait(false);
}