SPMember Class
The SPMember class is the base class for the SPUser, SPRole, and SPGroup classes.
System.Object
Microsoft.SharePoint.SPMember
Public Properties
The following table shows the public properties of the SPMember class, the data type of each property, and a brief description of each.
Name | Data Type | Description |
---|---|---|
ID | Int32 | Gets the member ID for the user, site group, or cross-site group. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.
Remarks
Each user, site group, or cross-site group in a site has a unique member ID, has the permissions associated with that membership, and can be represented by an SPMember object. You can use an indexer to return a specific SPUser, SPRole, or SPGroup object for a site and then assign the object to an SPMember object, as follows:
[Visual Basic .NET]
Dim site As SPWeb = SPControl.GetContextSite(Context).AllWebs("Site_Name")
Dim memUser As SPMember = site.Users("User_Name")
Dim memSiteGroup As SPMember = site.Roles("Site_Group_Name")
Dim memCrossSiteGroup As SPMember = site.SiteGroups("Cross-Site_Group_Name")
[C#]
SPWeb site = SPControl.GetContextSite(Context).AllWebs["Site_Name"];
SPMember memUser = site.Users["User_Name"];
SPMember memSiteGroup = site.Roles["Site_Group_Name"];
SPMember memCrossSiteGroup = site.SiteGroups["Cross-Site_Group_Name"];
Use the Member property of the SPPermission class to get the member that represents the user, site group, or cross-site group associated with a permission.
Requirements
Namespace: Microsoft.SharePoint
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security