-
StackOverflow 文档
-
sharepoint 教程
-
使用托管客户端对象模型(CSOM)
-
角色。创建角色定义
ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection");
Web oWebsite = clientContext.Web;
BasePermissions permissions = new BasePermissions();
permissions.Set(PermissionKind.CreateAlerts);
permissions.Set(PermissionKind.ManageAlerts);
RoleDefinitionCreationInformation roleCreationInfo = new RoleDefinitionCreationInformation();
roleCreationInfo.BasePermissions = permissions;
roleCreationInfo.Description = "A new role with create and manage alerts permission";
roleCreationInfo.Name = "Create and Manage Alerts";
roleCreationInfo.Order = 4;
RoleDefinition oRoleDefinition = oWebsite.RoleDefinitions.Add(roleCreationInfo);
clientContext.ExecuteQuery();
Console.WriteLine("{0} role created.", oRoleDefinition.Name);