sharepoint角色。创建一个SharePoint组并将该组添加到角色

示例

ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection/MyWebSite");

Web oWebsite = clientContext.Web;

GroupCreationInformation groupCreationInfo = new GroupCreationInformation();

groupCreationInfo.Title = "My New Group";

groupCreationInfo.Description = "新群组的描述。";

Group oGroup = oWebsite.SiteGroups.Add(groupCreationInfo);

RoleDefinitionBindingCollection collRoleDefinitionBinding = new RoleDefinitionBindingCollection(clientContext);

RoleDefinition oRoleDefinition = oWebsite.RoleDefinitions.GetByType(RoleType.Contributor);

collRoleDefinitionBinding.Add(oRoleDefinition);

oWebsite.RoleAssignments.Add(oGroup, collRoleDefinitionBinding);

clientContext.Load(oGroup,

    group => group.Title);

clientContext.Load(oRoleDefinition,

    role => role.Name);

clientContext.ExecuteQuery();

Console.WriteLine("{0} created and assigned {1} role.", oGroup.Title, oRoleDefinition.Name);        }

           

以上是 sharepoint角色。创建一个SharePoint组并将该组添加到角色 的全部内容, 来源链接: utcz.com/z/350100.html

回到顶部