65.9K
CodeProject 正在变化。 阅读更多。
Home

SharePoint 2016 中的 _spPageContextInfo

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1投票)

2016 年 6 月 29 日

CPOL

2分钟阅读

viewsIcon

18481

SharePoint 2016 中的 _spPageContextInfo

什么是 _spPageContextInfo

_spPageContextInfo 是一个全局变量。它属于任何页面,如 wiki、发布页面和系统页面。它通过其属性为我们提供了大量关于网站的有用信息。例如,_spPageContextInfo.userLoginName 提供了当前登录用户的登录名。如果我们在 _spPageContextInfo 中没有这个属性,那么我们就必须进行 REST 调用来获取它。

2016 版的新增功能

SharePoint 2016 中有以下新属性

属性名称 描述
isAppWeb 如果您的当前网站是应用程序网站,它将返回 true
updateFormDigestPageLoaded 这是一个日期时间对象,表示您的表单摘要何时被更新。
userLoginName 当前用户的登录名。
isSiteAdmin 如果当前用户是当前网站的管理员,它将返回 true
ProfileUrl 它将为您提供当前用户的“我的网站” URL。

比较矩阵(2013 vs 2016 vs Online)

下面给出了 _spPageContextInfo 的比较矩阵(2013 vs 2016 vs Online)

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

结论

这就是关于 SharePoint 2016 中 _spPageContextInfo 的全部内容。我希望您会喜欢它,并随时欢迎您让我知道您的反馈。

© . All rights reserved.