SPUser class
This class is primarily used with the PageContext
class. It provides contextual information for the SharePoint user that is accessing the page.
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the SPUser
class.
Properties
display |
The display name for the current user. |
The email address for the current user. |
|
first |
Returns the user's regional first day of week setting or undefined if it hasn't been set. |
is |
Returns if the current user is an anonymous guest. |
is |
Returns true if the current user is an external guest. |
login |
The login name for current user. |
prefer |
This boolean represents if a the user or web's time zone settings should be used to display the current time. |
time |
Returns the user's regional timezone settings or undefined if they haven't been set. |
Property Details
displayName
The display name for the current user.
readonly displayName: string;
Property Value
string
Remarks
Example: "John Doe"
The email address for the current user.
readonly email: string;
Property Value
string
Remarks
Example: "example@contoso.com"
firstDayOfWeek
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns the user's regional first day of week setting or undefined if it hasn't been set.
readonly firstDayOfWeek: SPDayOfWeek | undefined;
Property Value
SPDayOfWeek | undefined
isAnonymousGuestUser
Returns if the current user is an anonymous guest.
readonly isAnonymousGuestUser: boolean;
Property Value
boolean
isExternalGuestUser
Returns true if the current user is an external guest.
readonly isExternalGuestUser: boolean;
Property Value
boolean
loginName
The login name for current user.
readonly loginName: string;
Property Value
string
Remarks
Example: on-premise user: "domain\user"
, online user: "user@domain.com"
preferUserTimeZone
This boolean represents if a the user or web's time zone settings should be used to display the current time.
readonly preferUserTimeZone: boolean;
Property Value
boolean
timeZoneInfo
Note
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Returns the user's regional timezone settings or undefined if they haven't been set.
readonly timeZoneInfo: SPTimeZone | undefined;
Property Value
SPTimeZone | undefined