0

I would like to update regional settings (TimeZone to be exact) in 1000 sites.

I found the right property $ctx.Web.RegionalSettings.TimeZone, but it is read-only. I searched for any functions allowing to modify the TimeZone, but did not find any (no TimeZones.Add() or .SetAsDefault()).

  1. Manual change is not an option.
  2. LocaleID is not the same as TimeZone. Please do not offer solutions to change LocaleID.
  3. There are no issues connecting to SPO or reading data. I can retrieve/read the current Zone with code:

13 (UTC-08:00) Pacific Time (US and Canada)

Question
How can I update $ctx.Web.RegionalSettings.TimeZone for 1000 sites using code?

1

The answer is to set TimeZone as a TimeZone:

 $ctx.Load($ctx.Web)
 $ctx.Load($ctx.Web.RegionalSettings.TimeZone)
 $ctx.Load($ctx.Web.RegionalSettings.TimeZones)
 $ctx.ExecuteQuery()    


   $ctx.Web.RegionalSettings.TimeZone=$ctx.Web.RegionalSettings.TimeZones.GetbyID($TimeZoneID)
$ctx.Web.Update()
$ctx.ExecuteQuery()

The answer comes from the amazing Vesa Juvonen and his blog: http://blogs.msdn.com/b/vesku/archive/2015/04/10/new-sharepoint-csom-version-released-for-office-365.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.