SPSite class

This class is primarily used with the PageContext class. It provides contextual information for the SharePoint site collection ("SPSite") that hosts 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 SPSite class.

Properties

absoluteUrl

Returns the absolute URL for this SPSite.

cdnPrefix

Returns the prefix of the application's specified cdn or an empty string if there isn't one.

classification

Returns the classification of the site.

correlationId

Returns the correlation id to the current server request.

group

Contextual information about the O365 Group associated with this site. If there is no O365Group associated with the current site, this property will be undefined.

id

The GUID that identifies the SPSite on the server.

isNoScriptEnabled

Returns true if isNoScript has been enabled on the SPSite.

recycleBinItemCount

The amount of items in the recycle bin.

serverRelativeUrl

Returns the server-relative URL for this SPSite.

serverRequestPath

Returns serverRelativeUrl of the original request.

sitePagesEnabled

Returns true if SitePages are enabled on this SPSite.

Property Details

absoluteUrl

Returns the absolute URL for this SPSite.

readonly absoluteUrl: string;

Property Value

string

Remarks

Example: "https://example.com/sites/PubSite"

cdnPrefix

Returns the prefix of the application's specified cdn or an empty string if there isn't one.

readonly cdnPrefix: string;

Property Value

string

classification

Returns the classification of the site.

readonly classification: string;

Property Value

string

correlationId

Returns the correlation id to the current server request.

readonly correlationId: Guid;

Property Value

group

Contextual information about the O365 Group associated with this site. If there is no O365Group associated with the current site, this property will be undefined.

readonly group: O365GroupAssociation | undefined;

Property Value

@microsoft/sp-page-context!O365GroupAssociation:class | undefined

id

The GUID that identifies the SPSite on the server.

readonly id: Guid;

Property Value

isNoScriptEnabled

Returns true if isNoScript has been enabled on the SPSite.

readonly isNoScriptEnabled: boolean;

Property Value

boolean

recycleBinItemCount

The amount of items in the recycle bin.

readonly recycleBinItemCount: number;

Property Value

number

serverRelativeUrl

Returns the server-relative URL for this SPSite.

readonly serverRelativeUrl: string;

Property Value

string

Remarks

Example: "/sites/PubSite"

serverRequestPath

Returns serverRelativeUrl of the original request.

readonly serverRequestPath: string;

Property Value

string

Remarks

Example: "/teams/SPClientTest/SitePages/Home.aspx"

sitePagesEnabled

Returns true if SitePages are enabled on this SPSite.

readonly sitePagesEnabled: boolean;

Property Value

boolean