SOLVED

Time Zone Settings for O365 Groups SharePoint-Site

Brass Contributor

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!

32 Replies

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

Yep,
You can still to this :)

Well done santosh, it works. Awesome :)

Thanks for this script - going to be very useful for my UK clients. However, am I the only one who thinks that regional settings and timezones in Office 365 are just broken? Why are their regional settings per anything at all? Sure, I can show my client how to change from USA to UK time zone and UK formats, but why is this setting there at all? Surely the entire Office 365 suite esp. SharePoint should pick up my own regional settings in my profile and use that to adjust UTC dates to my local time zone and then the locale settings to decide how to display it?

 

How does all of this work for a global company where they have users in different time zones? Surely those in the USA want to know what the local time was when a UK user edited a file?

 

This has perplexed me since I start using Office 365 and now it's a bee in my bonnet. I see the original poster acknowledges this is a mess!

 

sshot-1.png

The more I'm using new 365 features like Groups and Teams, the more I'm coming across this complete cluster-f*%^ that is regional settings. It has not been thought through at all by Microsoft. The world seems to start and end in the United States, completely ignoring anyone with a regional setting anywhere else that the US. The amount of different places where it is wrong is staggering, even between things that are supposed to be unified such as a O365 Group and Modern Team site.

Interesting. I get lots of access errors when I try to run this script. I'm logged in as a tenant administrator.  It seems like the error is generated when the script attempts to update the settings. Is there anything special that needs to be done to set up the script to work? 

 

SPSError.jpg

@Tony Redmond I think site designs is now the better way to do this, here is how I set timezone by default on new sites

 

https://regarding365.com/set-the-default-region-and-timezone-for-microsoft-teams-sites-a3b4d98da8c1

 

You can also apply a sitedesign using powershell to an existing site using Invoke-SPOSiteDesign.

Yes, I know about site designs and am using one very successfully for new sites created by Groups and Teams (and will have an article about same on Petri.com soon after I get some other stuff done). The question is how to deal with old sites that still have the Pacific time zone. I'll look at the Invoke-SpoSiteDesign cmdlet. Maybe it will be more cooperative than CSOM.

The Invoke-SPOSiteDesign method works pretty well. At least, it updated 109 of my 142 groups. I don't quite know why the other sites failed to be updated because I ran the script using the Administrator (tenant global administrator) account, but c'est la vie.

 

Here's what I used:

$SitesUpdated = 0
$SiteProblems = 0
$DesignID = "11c2efae-d0eb-4eb9-af71-4f4f5c5c6db8"
$Groups = (Get-UnifiedGroup | ? {$_.SharePointSiteUrl -ne $Null} | Select SharePointSiteUrl, DisplayName, Alias)
ForEach ($G in $Groups) {
     Try {
          Write-Host "Processing" $G.SharePointSiteUrl "for group" $G.DisplayName
          Invoke-SPOSiteDesign -Identity $DesignID -WebUrl $G.SharePointSiteURL -ErrorAction Stop
          $SitesUpdated++
          Set-UnifiedGroup -Identity $G.Alias -CustomAttribute13 "Site Design Updated" }
    Catch {
          Write-Host "Problem Processing" $G.SharePointSiteURL
         $SiteProblems++ }
}

Here is a tweak on the script that was shared to set the TimeZone on all sharepoint sites in a tenant. I think this works a bit quicker/better then just doing it for team sites, since all the communication sites need the timezone fixed as well.

 

(I tired to add this as a code block but the editor did not like it)

 



$cred = get-credential

$TimezoneValue= "(UTC-06:00) Central Time (US and Canada)"
$localeid = 1033
Connect-SPOService -Url https://<<TenantName>>-admin.sharepoint.com -Credential $cred
 
$Groups = Get-SPOSite | select URL
#Authenticate to Site
$Username =$cred.UserName.ToString()
$Password = $cred.GetNetworkCredential().Password
$SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$SecurePassword)

foreach($site in $Groups.URL)
{
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Context.Credentials = $Creds

$TimeZones = $Context.Web.RegionalSettings.TimeZones
$Context.Load($TimeZones)
$Context.ExecuteQuery()
$TimeZone = $TimeZones | Where {$_.Description -eq $TimezoneValue}

#Changing the timezone
$RegionalSettings = $Context.Web.RegionalSettings
$Context.Load($RegionalSettings)
$Context.ExecuteQuery()
$RegionalSettings.TimeZone = $TimeZone
$RegionalSettings.Localeid = $localeid
$Context.Web.Update()
$Context.ExecuteQuery()

Write-Host "Time Zone successfully updated for $($site) "
}

 

Hi 

All I would like to do is update the language for all Office365 groups. 

when I try to use your script I get the below error. 

the groups are private and I am a global admin 

 

Any help would be great. thank you. 

 

Exception calling "ExecuteQuery" with "0" argument(s): "Access denied. You do not have permission to perform this
action or access this resource."
At line:18 char:1
+ $Context.ExecuteQuery()
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ServerUnauthorizedAccessException

Being a Global Admin that not provides you with the rights to change settings that only a SPO Site Admin can do...so to change the settings in all the groups you would need to be an admin there or ask an admin to execute your script

Only this solution WORKED for me:

https://chuvash.eu/2019/08/30/update-localeid-and-timezone-with-pnp/

 

I was finally to change LocaleID on my existing Sharepoint site for correct formula language in Excel Online files.

 

Sharepoint LocalZones ID here

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-csom/jj171282(v%3Doffice.15)