// Read properties and relationships of group members. // This snippet requires an admin work account. public async Task <ActionResult> GetOwners(string id) { ResultsViewModel results = new ResultsViewModel(false); try { // Get group owners. results.Items = await groupsService.GetOwners(id); } catch (ServiceException se) { if ((se.InnerException as AuthenticationException)?.Error.Code == Resource.Error_AuthChallengeNeeded) { HttpContext.Request.GetOwinContext().Authentication.Challenge(); return(new EmptyResult()); } return(RedirectToAction("Index", "Error", new { message = string.Format(Resource.Error_Message, Request.RawUrl, se.Error.Code, se.Error.Message) })); } return(View("Groups", results)); }
// Read properties and relationships of group members. // This snippet requires an admin work account. public async Task <ActionResult> GetOwners(string id) { ResultsViewModel results = new ResultsViewModel(false); try { // Initialize the GraphServiceClient. GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient(); // Get group owners. results.Items = await groupsService.GetOwners(graphClient, id); } catch (ServiceException se) { if (se.Error.Message == Resource.Error_AuthChallengeNeeded) { return(new EmptyResult()); } return(RedirectToAction("Index", "Error", new { message = string.Format(Resource.Error_Message, Request.RawUrl, se.Error.Code, se.Error.Message) })); } return(View("Groups", results)); }