As SharePoint Online will not allow any server side code, we have to depend on SharePoint JavaScript Client Side Object Modal. We may not have all the features we get at server side but now a days Microsoft enhancing the SharePoint Client object modal a lot to support most the things while work lists, libraries, items, documents and user profiles.
There is one global object available while working with JavaScript in SharePoint Online and that is _spPageContextInfo. You can access all current logged in user related properties as mentioned below,
Display Name - _spPageContextInfo.userDisplayName
User Id - _spPageContextInfo.userId
Email - _spPageContextInfo.userEmail
Login Name - _spPageContextInfo.userLoginName
Is site admin - _spPageContextInfo.isSiteAdmin
Also current site details,
Current site collection URL - _spPageContextInfo.siteAbsoluteUrl
Current Site collection relative URL - _spPageContextInfo.siteServerRelativeUrl
Current web site relative URL - _spPageContextInfo.webServerRelativeUrl
Current web site URL - _spPageContextInfo.webAbsoluteUrl
Current Site Culture name - _spPageContextInfo.currentCultureName
Current Site Language LCID - _spPageContextInfo.currentLanguage
No comments:
Post a Comment