/// <summary> /// Initializes the NextPageRequest property. /// </summary> public void InitializeNextPageRequest(IBaseClient client, string nextPageLinkString) { if (!string.IsNullOrEmpty(nextPageLinkString)) { this.NextPageRequest = new UserDirectReportsCollectionWithReferencesRequest( nextPageLinkString, client, null); } }
/// <inheritdoc/> internal override async Task <IEnumerable <DirectoryObject> > CallGraphServiceWithResultAsync(IGraphServiceClient client, IReadOnlyDictionary <string, object> parameters, CancellationToken cancellationToken) { string userId = (string)parameters["UserId"]; int maxCount = (int)parameters["MaxResults"]; string propertiesToSelect = (string)parameters["PropertiesToSelect"]; // Create the request first then apply the Top() after IUserDirectReportsCollectionWithReferencesRequest request = client.Users[userId].DirectReports.Request().Select(propertiesToSelect); if (maxCount > 0) { request = request.Top(maxCount); } IUserDirectReportsCollectionWithReferencesPage result = await request.GetAsync(cancellationToken).ConfigureAwait(false); // Again only return the top N results but discard the other pages if the manager has more than N direct reports return(result.CurrentPage); }