Know your Office 365 and SharePoint 2016 _spPageContextInfo

As I’ve worked with SharePoint over the past several years, more specifically the client side development aspect of it, one component of JavaScript Object Model that I can’t live without is the _spPageContextInfo object. It is available within every SharePoint page after the SharePoint Client Context object has been loaded. The _spPageContextInfo object has been available since SharePoint 2010 and has grown since then to include the following attributes.

  SP2010 SP2013 SP2016 O365 O365 w/ SP Framework Example
alertsEnabled X X X X X true
allowSilverlightPrompt X X X X X “True”
clientServerTimeDelta   X X X -332
cdnPrefix         X static.sharepointonline.com/bld
CorrelationId         X 838295cd-201d-3aaa-3636-8cce395479ae
crossDomainPhotosEnabled   X X X X false
currentCultureName   X X X X “en-US”
currentLanguage X X X X X 1033
currentUICultureName   X X X X “en-US”
env       X X “Prod”
ExpFeatures X [ -1935704048, 1880353600, 1561415744, 33620252, 320014136, -1798548608, 12582919, 57158685, 4785188, -2046689280, 1049488, -536678120, -134118912, 1098973635, 2159492, 1879965696, -702520078, -535095679, 16928863, 0, 0, 268435456, -2145386494, 16777222, 0, 8, 0, 0, 0, 0, 0, 5888, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32768 ]
farmLabel X US_5_Content
fid X 16214
groupAlias X null
groupColor X null
groupId X null
groupType X null
hasManagedWebPermissions X X X true
hideSyncButtonOnODB X FALSE
isAppWeb X X X true
isNoScriptEnabled X FALSE
isSiteAdmin X X X true
killSwitches X {“F8FF3F1E-AB40-4AE1-7BB9-8BB67172EB53”, true,
“0DD76D5B-35B6-42D0-AB40-7DDED9F09F98”, true,
“3C70F5DC-8D7E-4DAB-B53C-07A9C3E8D7C8”, true,
“E589C138-7DD8-42D0-4DAB-EBC92D395B94”, true,
“639A0731-C514-42BC-84ED-8BB67172EB53”, true,
“4D64EB0F-E71C-42D0-42BC-6B47CA92386E”, true,
“343B4477-F7AC-4143-A26A-559457481FBD”, true,
“88D8F6DE-F224-4D94-B53C-EBC92D395B94”, true,
“4D64EB0F-5309-42D0-8010-559457481FBD”, true}
layoutsUrl X X X X “_layouts/15”
listBaseTemplate X -1
listId X
listPermsMask X null
listTitle X null
listUrl X
navigationInfo X null
nid X 125
openInClient X FALSE
pageItemId X X X X X 10
pageListId X X X X X “{2c3b629a-ea6a-4b50-bd00-9686d627941d}”
pagePersonalizationScope X X X X 1
ProfileUrl X X “https://cribtoso-my.sharepoint.com/person.aspx”
serverRequestPath X X X X “/Pages/default.aspx”
serverTime X 2016-05-13T14:00:55.7911099Z
showNGSCDialogForSyncOnODB X FALSE
siteAbsoluteUrl X X X X “http://cribtososp16a01”
siteClientTag X X X X “43$$16.0.4327.1000”
siteId X {a873bec2-11fc-4952-8301-c90abc09767d}
siteServerRelativeUrl X X X X X “/sites/sitesandbox”
siteSubscriptionId X f59e3cb7-4bff-4aed-91a0-3a11c07128e8
systemUserKey X X X X S-1-0-0
tenantAppVersion X X X X “3904492014”
themeCacheToken X X X “/sites/sandboxsite::0:16.0.5124.1208”
themedCssFolderUrl X X X “/_catalogs/theme/Themed/7FA80357”
themedImageFileNames X X X [object Object]
updateFormDigestPageLoaded X X “Wed Apr 27 2016 19:20:30 GMT+0000 (Coordinated Universal Time)”
userDisplayName X John Smith
userId X X X X X 1073746825
userLoginName X X X “test.user@cribtoso.com” or  “cribtoso\testuser”
viewId X
webAbsoluteUrl X X X X “http://cribtososp16a01/sites/sandboxsite”
webId X {0f93846b-2c35-483b-abb4-ecab385ec2c2c}
webLanguage X X X X X 1033
webLogoUrl X X X X “_layouts/15/images/siteicon.png”
webPermMasks X X X X [object Object]
webServerRelativeUrl X X X X X “/sites/sandboxsite”
webTemplate X X X X “53”
webTitle X X X X “Cribtoso SP Sandbox Site”
webUIVersion X X X X X 15

Once you start using the _spPageContextInfo object on a regular basis, you’ll wonder how you lived without it before.Looking at the table, you’ll notice some new items for SharePoint 2016 and Office 365. Items like the userLoginName, the ProfileUrl, and the env property will be super helpful given the emphasis that SharePoint 2016 has made on hybrid environments. Microsoft is constantly updating the Office 365 environment with a specific focus on enhancing the personalized experience for users through their profile sites in the cloud. Having the ProfileUrl at your fingertips, provided by SharePoint, will always keep you pointing at the latest updated profile experience regardless of whether the page is in the cloud or on premise.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *