public async Task<List<DirectoryObject>> GetUserDirectReportsAsync(string userId) { try { var graphServiceClient = await AuthenticationHelper.GetGraphServiceAsync(AuthenticationHelper.EndpointUrl); var directReportsBuilder = new UserDirectReportsCollectionWithReferencesRequestBuilder(string.Format("{0}/users/{1}/directReports", AuthenticationHelper.EndpointUrl, userId), graphServiceClient); var directReport = (await directReportsBuilder.Request().GetAsync()).CurrentPage.ToList(); return directReport; } catch (Exception el) { el.ToString(); } return null; }
public async Task <List <DirectoryObject> > GetUserDirectReportsAsync(string userId) { try { var graphServiceClient = await AuthenticationHelper.GetGraphServiceAsync(AuthenticationHelper.EndpointUrl); var directReportsBuilder = new UserDirectReportsCollectionWithReferencesRequestBuilder(string.Format("{0}/users/{1}/directReports", AuthenticationHelper.EndpointUrl, userId), graphServiceClient); var directReport = (await directReportsBuilder.Request().GetAsync()).CurrentPage.ToList(); return(directReport); } catch (Exception el) { el.ToString(); } return(null); }