Forum Discussion
Andreas Schlüter
Nov 02, 2016Copper Contributor
Time Zone Settings for O365 Groups SharePoint-Site
Hi everybody, most of us know the different places where time zones are to set in O365 - SharePoint Sites, ODFB, Users, etc. This is a mess... I (Owner & Member) tried to set the time zone fo...
- Nov 02, 2016
You can use the below script for this.
To Get the time zone index values
https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx
To get Locale ID
https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx
$cred= Get-Credential $TimezoneValue= "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi"
$localeid = 5129 $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection Import-PSSession $Session #Add references to SharePoint client assemblies Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client").location) Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.runtime").location) $Groups =Get-UnifiedGroup |Where-Object {$_.SharePointSiteUrl -ne $null}|select SharePointSiteUrl foreach($Group in $Groups.SharePointSiteUrl) { #Authenticate to Site $Username =$cred.UserName.ToString() $Password = $cred.GetNetworkCredential().Password $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force $Site = $Group $Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site) $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$SecurePassword) $Context.Credentials = $Creds $TimeZones = $Context.Web.RegionalSettings.TimeZones $Context.Load($TimeZones) $Context.ExecuteQuery() #Changing the timezone $RegionalSettings = $Context.Web.RegionalSettings $Context.Load($RegionalSettings) $Context.ExecuteQuery() $TimeZone = $TimeZones | Where {$_.Description -eq $TimezoneValue} $RegionalSettings.TimeZone = $TimeZone
$RegionalSettings.Localeid = $localeid $Context.Web.Update() $Context.ExecuteQuery() Write-Host "Time Zone successfully updated for $($site) " }
Salvatore Biscari
Nov 16, 2016Silver Contributor
Why, in first place, does one get access denied when trying to set the timezone for an Office 365 Group?
Does someone know the answer?
- Nov 16, 2016I'm not having such access denied error
- Salvatore BiscariNov 16, 2016Silver Contributor
Well, I am the Group owner (and tenant GA too...), I go to the Group, I go to Site Setting and then to International Settings, I change the Timezone, I click OK and I get Access denied. BTW in this case it is a private Group.
Can you reproduce this steps?
- Nov 16, 2016I have just done over the same Group that was Public but I change to Private before making the changes in the regional settings