IPagedCollection<IApplication> applications = null; //Get the App where I want to add the functionality applications = activeDirectoryClient.Applications.Where(e => e.AppId == "APPId").ExecuteAsync().Result; //Get the appApplication appObject = (Application)applications.FirstOrDefault(); AppRole appRole = new AppRole(); //Assign the first Approle to the approle appRole = appObject.AppRoles.FirstOrDefault(); //retrived a single user User user = (User)retrievedUsers.First(); //Assign the approleassignments to user AppRoleAssignment appRoles = new AppRoleAssignment(); appRoles.Id = appRole.Id; appRoles.ResourceId = Guid.Parse(appObject.ObjectId); appRoles.PrincipalDisplayName = appRole.DisplayName; appRoles.ResourceDisplayName = appRole.DisplayName; appRoles.PrincipalType = "User"; appRoles.PrincipalId = Guid.Parse(user.ObjectId); user.AppRoleAssignments.Add(appRoles); user.UpdateAsync().Wait();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)