Sunday, 24 September 2017

_spPageContextInfo in SharePoint

This is a simple object that you will find on every SharePoint page. It will give you below information.

sample code:

if (_spPageContextInfo != null) {
            if (_spPageContextInfo.pageListId != null) {
                var pageListId = _spPageContextInfo.pageListId;
            }
            if (_spPageContextInfo.siteAbsoluteUrl && _spPageContextInfo.siteAbsoluteUrl != '') {
               var siteAbsoluteUrl = _spPageContextInfo.siteAbsoluteUrl
            }
        }


No comments:

Post a Comment