SecurableObject クラス
セキュリティの権限を割り当てることができるオブジェクトです。
継承階層
System.Object
Microsoft.SharePoint.Client.ClientObject
Microsoft.SharePoint.Client.SecurableObject
Microsoft.SharePoint.Client.List
Microsoft.SharePoint.Client.ListItem
Microsoft.SharePoint.Client.Web
名前空間: Microsoft.SharePoint.Client
アセンブリ: Microsoft.SharePoint.Client.Silverlight (Microsoft.SharePoint.Client.Silverlight.dll 内); Microsoft.SharePoint.Client.Phone (Microsoft.SharePoint.Client.Phone.dll 内) Microsoft.SharePoint.Client (Microsoft.SharePoint.Client.dll 内)
構文
'宣言
Public Class SecurableObject _
Inherits ClientObject
'使用
Dim instance As SecurableObject
public class SecurableObject : ClientObject
注釈
既定のスカラー プロパティの種類を設定するのには、HasUniqueRoleAssignments プロパティが含まれていません。
例
この例では、新しいアクセス許可レベルを作成し、アクセス許可レベルで知らせリストにユーザーを追加します。
using System;
using Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointFoundation.Samples
{
class SecurableObjectExample
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
Site collSite = clientContext.Site;
Web site = clientContext.Web;
// Set up permissions.
BasePermissions permissions = new BasePermissions();
permissions.Set(PermissionKind.ViewListItems);
permissions.Set(PermissionKind.AddListItems);
permissions.Set(PermissionKind.EditListItems);
permissions.Set(PermissionKind.DeleteListItems);
// Create a new role definition.
RoleDefinitionCreationInformation rdcInfo = new RoleDefinitionCreationInformation();
rdcInfo.Name = "Manage List Items";
rdcInfo.Description = "Allows a user to manage list items";
rdcInfo.BasePermissions = permissions;
RoleDefinition roleDef = collSite.RootWeb.RoleDefinitions.Add(rdcInfo);
// Create a new RoleDefinitionBindingCollection object.
RoleDefinitionBindingCollection collRDB = new RoleDefinitionBindingCollection(clientContext);
// Add the role to the collection.
collRDB.Add(roleDef);
// Get a securable object to work with (the Announcements list), and use the SecurableObject.BreakPermissions method to break permissions so they can be managed directly.
SecurableObject listSecurable = site.Lists.GetByTitle("Announcements");
listSecurable.BreakRoleInheritance(true, false);
// Use the SecurableObject.roleAssignments property to get the RoleAssignmentCollection for the list.
RoleAssignmentCollection collRoleAssign = listSecurable.RoleAssignments;
// Add the user to the target list and assign the user to the new RoleDefinitionBindingCollection.
RoleAssignment rollAssign = collRoleAssign.Add(site.CurrentUser, collRDB);
clientContext.ExecuteQuery();
Console.WriteLine("Security modified");
}
}
}
スレッド セーフ
この型のパブリック static (Visual Basic のShared ) メンバーはいずれもスレッド セーフです。インスタンス メンバーはスレッド セーフになるという保証はありません。