Edit

Share via


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.

sitePagesFeatureVersion

Returns site pages feature version number if defined on this SPSite. Example, for version 16.0.4.0 this would return 4.

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

O365GroupAssociation | 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

sitePagesFeatureVersion

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 site pages feature version number if defined on this SPSite. Example, for version 16.0.4.0 this would return 4.

readonly sitePagesFeatureVersion: number;

Property Value

number