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;
        }
Ejemplo n.º 2
0
        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);
        }