Table of Contents

Interface ISharePointUser

Namespace
PnP.Core.Model.Security
Assembly
PnP.Core.dll

Public interface to define a SharePoint User

public interface ISharePointUser : IDataModel<ISharePointUser>, IDataModelParent, IDataModelWithContext, ISupportModules<ISharePointUser>, IDataModelGet<ISharePointUser>, IDataModelLoad<ISharePointUser>, IDataModelDelete, ISharePointPrincipal, IQueryableDataModel
Inherited Members
Extension Methods

Properties

AadObjectId

Id of the underlying graph object (if any)

string AadObjectId { get; set; }

Property Value

string

All

A special property used to add an asterisk to a $select statement

object All { get; }

Property Value

object

Department

Department of the user

string Department { get; set; }

Property Value

string

Expiration

A date/time string for which the format conforms to the ISO8601 time format YYYY-MM-DDTHH:MM:SSZ and which represents the time and date of expiry for the user. A null value indicates no expiry.

string Expiration { get; }

Property Value

string

Groups

Returns the collection of ISharePointGroup this user is a direct member of. Membership obtained indirectly, by being part of a Microsoft Entra ID group that is itself a member of the SharePoint group, is not expanded and therefore not returned. Use GetTransitiveGroupsAsync() for that.

ISharePointGroupCollection Groups { get; }

Property Value

ISharePointGroupCollection

IsEmailAuthenticationGuestUser

Indicates whether the user is a guest user authenticated via an e-mail address

bool IsEmailAuthenticationGuestUser { get; }

Property Value

bool

IsShareByEmailGuestUser

Indicates whether the user is a guest user shared by e-mail

bool IsShareByEmailGuestUser { get; }

Property Value

bool

IsSiteAdmin

Indicates whether the user is a site collection administrator

bool IsSiteAdmin { get; }

Property Value

bool

Mail

E-mail address of the user. SP REST property name: Email

string Mail { get; set; }

Property Value

string

UserPrincipalName

User principle name (UPN) of the user

string UserPrincipalName { get; set; }

Property Value

string

Methods

AddRoleDefinitions(params string[])

Adds role definitions for this user

bool AddRoleDefinitions(params string[] names)

Parameters

names string[]

Returns

bool

AddRoleDefinitionsAsync(params string[])

Adds role definitions for this user

Task<bool> AddRoleDefinitionsAsync(params string[] names)

Parameters

names string[]

Returns

Task<bool>

AsGraphUser()

Returns this SharePoint user as a Graph user

IGraphUser AsGraphUser()

Returns

IGraphUser

AsGraphUserAsync()

Returns this SharePoint user as a Graph user

Task<IGraphUser> AsGraphUserAsync()

Returns

Task<IGraphUser>

GetRoleDefinitions()

Retrieves the role definitions for this user

IRoleDefinitionCollection GetRoleDefinitions()

Returns

IRoleDefinitionCollection

GetRoleDefinitionsAsync()

Retrieves the role definitions for this user

Task<IRoleDefinitionCollection> GetRoleDefinitionsAsync()

Returns

Task<IRoleDefinitionCollection>

GetTransitiveGroups()

Returns the SharePoint groups of the current site this user is a member of, either directly or through a Microsoft Entra ID security group (including nested groups) or Microsoft 365 group that is a member of the SharePoint group. Whenever the site groups contain such a group this uses Microsoft Graph, which requires the GroupMember.Read.All permission next to permission to read the principal itself. The special "Everyone" and "Everyone except external users" claims are not taken into account.

IList<ISharePointGroup> GetTransitiveGroups()

Returns

IList<ISharePointGroup>

The SharePoint groups this user is a direct or transitive member of

GetTransitiveGroupsAsync()

Returns the SharePoint groups of the current site this user is a member of, either directly or through a Microsoft Entra ID security group (including nested groups) or Microsoft 365 group that is a member of the SharePoint group. Whenever the site groups contain such a group this uses Microsoft Graph, which requires the GroupMember.Read.All permission next to permission to read the principal itself. The special "Everyone" and "Everyone except external users" claims are not taken into account.

Task<IList<ISharePointGroup>> GetTransitiveGroupsAsync()

Returns

Task<IList<ISharePointGroup>>

The SharePoint groups this user is a direct or transitive member of

RemoveRoleDefinitions(params string[])

Removes role definitions for this user

bool RemoveRoleDefinitions(params string[] names)

Parameters

names string[]

Returns

bool

RemoveRoleDefinitionsAsync(params string[])

Removes role definitions for this user

Task<bool> RemoveRoleDefinitionsAsync(params string[] names)

Parameters

names string[]

Returns

Task<bool>