SharePoint Time Zone Collections from Regional Settings Page

Today I have something new in my plate, ie., explore new CSOM package release for Office 365. So I have downloaded the package as mentioned in that post and tried some coding stuff(will publish the detail post later).

From the release, they have mentioned some key updates as listed below,

  • Manage regional settings of a site
  • Manage language settings of a site
  • Manage auditing settings of a site
  • Control advance settings for document sets
  • Support for upcoming enhanced migration APIs
  • Control sandbox solution settings in site collection level
  • Secondary contact in site collection level
  • Sharing settings

Based on the updates, I got interested in Regional settings and that is the first one they have mentioned. So I started with that.

I always do some navigation stuff before start the coding. Same like that, today also I have navigated to Regional Settings page by navigating Site Settings > Regional Settings (under Site Administration ) and investigate how the SharePoint behaves in OOTB.

I have very much interested in manipulating the DOM element through browser developer tools and play with it. Same way today also I have opened the developer tool and explored the time zone dropdown control and start investigate that select element. wow.. it contains a lot of child elements with the timezone information (Id and Description).

Currently I have two trial accounts one from SharePoint Online and another one from Rackspace to validate weather the id and description are same for both the environments.

Both the environments has the same Id and description for the Time Zone Collections. So here comes the hack to get the ids for each timezone.

Explore TimeZone Collection
Explore TimeZone Collection

Get the Select element id and use the below javascript code to get the entire collection of time zones.

var timezones = document.getElementById("ctl00_PlaceHolderMain_ctl01_ctl01_DdlwebTimeZone").children;
var i;
for(i=0 ; i< timezones.length; i++){ console.log(timezones[i].getAttribute('Value') +" \t " + timezones[i].innerHTML ); }

Fetch Timezone Collections
Fetch Timezone Collections

The same way, we can do lot of tricks in sharepoint pages to get the different type of information. Start explore the SharePoint in different angle (Look for different angle – Dialogue from Big Hero 6 movie). :)

Shantha Kumar
Shantha Kumar
Articles: 278