Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint

_spPageContextInfo in SharePoint 2016

4.50/5 (3 votes)
29 Jun 2016CPOL2 min read 18K  
_spPageContextInfo in SharePoint 2016

What is _spPageContextInfo

_spPageContextInfo is a global variable. It belongs to any pages like wiki, publishing and system pages. It provides us so much useful information about the web by its properties. For example, _spPageContextInfo.userLoginName gives the login name of the current logged in user. If we do not have this property in _spPageContextInfo, then we have to make a REST call to get this.

What’s New in 2016

Following properties are new in SharePoint 2016:

Property Name Description
isAppWeb It will return true if your current web is an app web.
updateFormDigestPageLoaded It’s a date time object meaning when your form digest has been updated.
userLoginName Login name of the current user.
isSiteAdmin It will return true if current user is the admin of current site.
ProfileUrl It will give you the my site URL of current user.

Comparison Matrix (2013 vs 2016 vs Online)

Comparison matrix of _spPageContextInfo (2013 vs 2016 vs Online) is given below:

Name 2013 2016 Online
webServerRelativeUrl Yes Yes Yes
webAbsoluteUrl Yes Yes Yes
siteAbsoluteUrl Yes Yes Yes
serverRequestPath Yes Yes Yes
layoutsUrl Yes Yes Yes
webTitle Yes Yes Yes
webTemplate Yes Yes Yes
tenantAppVersion Yes Yes Yes
isAppWeb No Yes Yes
hasManageWebPermissions No No Yes
webLogoUrl Yes Yes Yes
webLanguage Yes Yes Yes
currentLanguage Yes Yes Yes
currentUICultureName Yes Yes Yes
currentCultureName Yes Yes Yes
clientServerTimeDelta Yes Yes Yes
updateFormDigestPageLoaded No Yes Yes
siteClientTag Yes Yes Yes
crossDomainPhotosEnabled Yes Yes Yes
webUIVersion Yes Yes Yes
webPermMasks Yes Yes Yes
pageListId Yes Yes Yes
pageItemId Yes Yes Yes
pagePersonalizationScope Yes Yes Yes
userId Yes Yes Yes
userLoginName No Yes Yes
systemUserKey Yes Yes Yes
isAnonymousGuestUser No No Yes
alertsEnabled Yes Yes Yes
siteServerRelativeUrl Yes Yes Yes
allowSilverlightPrompt Yes Yes Yes
themeCacheToken No No Yes
isSiteAdmin No Yes Yes
env No No Yes
ProfileUrl No Yes Yes

Conclusion

That’s all about _spPageContextInfo in SharePoint 2016. I hope you will enjoy it and always feel welcome to let me know your feedback.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)