コード例 #1
0
        public Task AddPermissionLevelToGroupAsync(GroupPermissionRequest request)
        {
            using var context = GetSharePointOnlineContext(request.SiteUrl);

            context.Web.AddPermissionLevelToGroup(request.GroupName, request.Role.GetRoleType());
            return(Task.CompletedTask);
        }
コード例 #2
0
        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
            });
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }