public Task AddPermissionLevelToGroupAsync(GroupPermissionRequest request) { using var context = GetSharePointOnlineContext(request.SiteUrl); context.Web.AddPermissionLevelToGroup(request.GroupName, request.Role.GetRoleType()); return(Task.CompletedTask); }
public async Task ExternalSharingAsync(ClientTeamRequest request) { var siteCollection = await siteCreation.CreateTeamSiteNoGroupAsync( new TeamSiteNoGroupRequest { Alias = request.SiteUrl, Title = request.SiteUrl, Language = Language.English, Owner = AppConfigurations.SpoUserAdmin }); var group = new GroupPermissionRequest { SiteUrl = siteCollection, GroupName = $"{request.SiteUrl} Clients", GroupDescription = "This is group for Client", Users = new[] { "*****@*****.**" }, }; await permissionClientApi.AddGroupAsync(group); await permissionClientApi.AddUserToGroupAsync(group); await fileClientApi.CreateFolderAsync(new CreateFolderRequest { SiteUrl = siteCollection, ListName = "Documents", FolderName = "Documents Client", IsSharing = true, TargerEmailToShare = group.GroupName, SharingOption = SharingDocumentOption.View }); }
public Task AddUserToGroupAsync(GroupPermissionRequest request) { using var context = GetSharePointOnlineContext(request.SiteUrl); foreach (var user in request.Users) { context.Web.AddUserToGroup(request.GroupName, user); } return(Task.CompletedTask); }
public Task AddPermissionLevelToUserAsync(GroupPermissionRequest request) { using var context = GetSharePointOnlineContext(request.SiteUrl); foreach (var user in request.Users) { context.Web.AddPermissionLevelToUser(user, request.Role.GetRoleType()); } return(Task.CompletedTask); }
public Task AddGroupAsync(GroupPermissionRequest request) { using var context = GetSharePointOnlineContext(request.SiteUrl); var groupExists = context.Web.GroupExists(request.GroupName); if (!groupExists) { context.Web.AddGroup(request.GroupName, request.GroupDescription, true); } return(Task.CompletedTask); }