SOLVED
Home

Time Zone Settings for O365 Groups SharePoint-Site

Highlighted
Andreas Schlüter
New 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 for a O365 Group Site via website-settings, but I got an access denied. Can anybody help me out, why I am not able to set the time zone?

Or is it possible via Powershell to set the time zone for (all) O365-Groups (or SharePoint-Sites, Users, ODFB, etc.)?

For ODFB, there is already a PS script in the OneDrive community - see https://techcommunity.microsoft.com/t5/OneDrive-for-Business/Timezone-setting-in-ODFB/m-p/7091#M153

 

Thanks!

  • Admin
  • Office 365 Groups
  • SharePoint
22 Replies
Solution

Re: Time Zone Settings for O365 Groups SharePoint-...

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) " }

 

 

 

RE: Time Zone Settings for O365 Groups SharePoint-...

Great script @Santhosh Balakrishnan

Re: Time Zone Settings for O365 Groups SharePoint-...

Thanks Santosh, that worked like a Charme!

Re: Time Zone Settings for O365 Groups SharePoint-...

Santosh

 

Thanks for the script - worked perfectly and solved the issue for me. Having trouble with adapting it to work for the Localeid. Could you point me in the right direction?

 

 

Re: Time Zone Settings for O365 Groups SharePoint-...

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?

Re: Time Zone Settings for O365 Groups SharePoint-...

I'm not having such access denied error

Re: Time Zone Settings for O365 Groups SharePoint-...

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?

Re: Time Zone Settings for O365 Groups SharePoint-...

I have just done over the same Group that was Public but I change to Private before making the changes in the regional settings

Re: Time Zone Settings for O365 Groups SharePoint-...

@Gary Martin Thanks for letting me know this. I have edited the script accordingly. 

Re: Time Zone Settings for O365 Groups SharePoint-...

Santhosh - That sorted my date format - thanks a lot for the quick response. Solved something that would have become a major irritation.

Re: Time Zone Settings for O365 Groups SharePoint-...

For me it gives access denied if I try to change the timezone for both public and private groups.

Any ideas?

Re: Time Zone Settings for O365 Groups SharePoint-...

Hi Santhosh. The script works perfectly. Thank you very much!

Nevertheless, some of my clients need to set the timezone interactively: do you know the reason behind the "Access denied" error and how to avoid it?

Re: Time Zone Settings for O365 Groups SharePoint-...

Hi @Salvatore Biscari, can you please try to add yourself as site collection admin and try again? This is the only case where the error you have mentioned occurs. 

Set-SPOUser -Site https://contoso.sharepoint.com/sites/marketing -LoginName melissa.kerr@contoso.com -IsSiteCollectionAdmin $true 

 

Re: Time Zone Settings for O365 Groups SharePoint-...

Thanks Santhosh, but unfortunately it doesn't work.

It looks like you cannot add a collection admin to a Group site...

Re: Time Zone Settings for O365 Groups SharePoint-...

Ey @Salvatore Biscari I think something is wrong with this Group I have just executed a similar PS to the one provied by @Santhosh Balakrishnan and I worked perfectly...so perfectly that I was able to add as Group Site Administrator a user that it's not a member of the Groupe neither an owner

$sSiteCollectionAdmin="dave@nuberosnet.onmicrosoft.com"
$GroupUrl="https://nuberosnet.sharepoint.com/sites/minioms/"
Set-SPOUser -Site $GroupUrl -LoginName $sSiteCollectionAdmin -IsSiteCollectionAdmin $true

Re: Time Zone Settings for O365 Groups SharePoint-...

Hi @Juan Carlos González Martín.

What was exactly the output you got after executing the script? I mean, how did you confirm it worked?

I am under the impression that it appears to work but it doesn't actually work...

Re: Time Zone Settings for O365 Groups SharePoint-...

Of course, see my screenshot :-). Fortunately I have not closed my PowerShell session :-)

Set_User_Group_Site_Admin.PNG

 

 

Re: Time Zone Settings for O365 Groups SharePoint-...

Thank you very much!

I had the same output, but in practice I had no effect, meaning that I am still not able to change the timezone...

Also, Get-SPOUser doesn't work...

How can we confirm positively that Set-SPOUser worked?

Re: Time Zone Settings for O365 Groups SharePoint-...

Mmmm...strange, no issues on my side with this Group...I might do some more further testing on other Groups or even other tenants

Re: Time Zone Settings for O365 Groups SharePoint-...

Well, this morning I have been able to change interactively the time zone for some newly created groups. Hence it appears the inability was only a temporary glitch...

BTW, I found a way to interactively add an SCA to the Group site (as well as to every other site): if you add the string "/_layouts/mngsiteadmin.aspx" to the site address, you will get a page in which you can edit the SCA list.

CC: @Juan Carlos González Martín @Santhosh Balakrishnan

Re: Time Zone Settings for O365 Groups SharePoint-...

Yep,
You can still to this :-)

Re: Time Zone Settings for O365 Groups SharePoint-...

Well done santosh, it works. Awesome :)

Related Conversations
Announcement: New OneDrive Admin Center Preview
Stephen Rose  in  OneDrive for Business  on
110 Replies
No Team Channel Notifications
Jake Baldwin  in  Microsoft Teams  on
44 Replies
Manage automatic creation of direct reports group
Scott Johnson  in  Office 365 Groups  on
100 Replies
Create private channel in a team
Catalin Prata  in  Microsoft Teams  on
21 Replies