Click here to Skip to main content
15,884,537 members
Articles / Productivity Apps and Services / Sharepoint

_spPageContextInfo in SharePoint 2016

Rate me:
Please Sign up or sign in to vote.
4.50/5 (3 votes)
29 Jun 2016CPOL2 min read 17.4K   1  
_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)


Written By
Instructor / Trainer Jashore University of Science and Technology
Bangladesh Bangladesh
2016 Microsoft MVP

Currently, I am devoted to provide technical and development support to the SharePoint clients and also I am working on angularjs. I am experienced with C#, ASP.NET, SharePoint, SignalR, angularjs, MS SQL, Oracle 11g R2, Windows Phone, Firefox OS and so on. I have fallen in love with many technologies but never got married to any of them. I am evolving myself as full stack developer. I always like to share knowledge as much as to gather from you.

Comments and Discussions

 
-- There are no messages in this forum --