RoleDefinitionCollection class

Represents the collection of RoleDefinition objects that define the role definitions that are available for use within the Web site.

Inheritance hierarchy


Namespace:  Microsoft.SharePoint.Client
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)


Public NotInheritable Class RoleDefinitionCollection _
    Inherits ClientObjectCollection(Of RoleDefinition)
Dim instance As RoleDefinitionCollection
public sealed class RoleDefinitionCollection : ClientObjectCollection<RoleDefinition>


This code example defines a new role and adds it to the role definitions collection.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
    class RoleDefinitionCollectionExample
        static void Main()
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            // Set up permissions.
            BasePermissions permissions = new BasePermissions();

            // Create a new role definition.
            RoleDefinitionCreationInformation rdcInfo = new RoleDefinitionCreationInformation();
            rdcInfo.Name = "Manage User";
            rdcInfo.Description = "Role for managing user permissions";
            rdcInfo.BasePermissions = permissions;
            rdcInfo.Order = 1;
            RoleDefinition roleDef = site.RoleDefinitions.Add(rdcInfo);


            Console.WriteLine("Created role: {0}", roleDef.Name);

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also


RoleDefinitionCollection members

Microsoft.SharePoint.Client namespace