Wednesday, July 31, 2013

JavaScript to get page and site information like url,.. in SharePoint

use 

alert(_spPageContextInfo.siteAbsoluteUrl);

_spPageContextInfo Object Properties found for SharePoint 2013 application:

  • alertsEnabled: false
  • allowSilverlightPrompt :"True"
  • clientServerTimeDelta :-8980
  • crossDomainPhotosEnabled: false
  • currentCultureName: "en-US"
  • currentLanguage: 1033
  • currentUICultureName: "en-US"
  • layoutsUrl: "_layouts/15"
  • pageListId:  "{df5e2d45-ad0b-4608-a813-ded6a97511db}"
  • pagePersonalizationScope:  1
  • serverRequestPath:  "/sites/dotnetmirror/Lists/Calender custom/calendar.aspx"
  • siteAbsoluteUrl: "http://computerName:5000/sites/dotnetmirror"
  • siteClientTag: "0$$15.0.4433.1506"
  • siteServerRelativeUrl; "/sites/dotnetmirror"
  • systemUserKey: "i:0).w|s-1-5-21-2086049...90378103-3194450012-500"
  • tenantAppVersion: "0"
  • userId: 1
  • webAbsoluteUrl: "http://computerName:5000/sites/dotnetmirror"
  • webLanguage: 1033
  • webLogoUrl:"_layouts/15/images/siteicon.png"
  • webPermMasks: Object { High=2147483647, Low=4294967295}
  • webServerRelativeUrl: "/sites/dotnetmirror"
  • webTemplate: "1"
  • webTitle : "dotnetmirror"

No comments: