Retrieve SharePoint Site TimeZone using CSOM

In this post, I’ll be retrieving a SharePoint site’s TimeZone using CSOM.

JS

var context = SP.ClientContext.get_current();
var timeZone = context.get_web().get_regionalSettings().get_timeZone();
context.load(timeZone);
context.executeQueryAsync(successHandler, errorHandler);

 

C#

using (ClientContext ctx = new ClientContext("siteUrl"))
{
	ctx.Credentials = new SharePointOnlineCredentials("userId", secureStringPassword);
	Microsoft.SharePoint.Client.TimeZone sharePointTimeZone = ctx.Web.RegionalSettings.TimeZone;

	ctx.Load(sharePointTimeZone);
	ctx.ExecuteQuery();
}

The output, in both the cases, will be:
Read More »