question

PitchHG-101 avatar image
0 Votes"
PitchHG-101 asked JulieWang-MSFT edited

How to change Modified Display Format to Standard view for all site/subsite in SharePoint Online?

140652-image.png


office-sharepoint-online
image.png (46.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PitchHG-101

I am currently looking into this issue and will give you an update as soon as possible.

Thank you for your understanding and support.

0 Votes 0 ·

1 Answer

JulieWang-MSFT avatar image
0 Votes"
JulieWang-MSFT answered JulieWang-MSFT edited

@PitchHG-101,

We can use following pnp powershell to disable the FieldFriendlyFormatType of Modified field in all sites/subsites, after that, Standard format will be used.
(Note, if you have no permission for site, you will get access denied error when set the field property)

 #Set Variables
 $SiteURL = "https://tenant.sharepoint.com/"
     
 #Get Credentials to connect
 $Cred = Get-Credential
     
 Try {
     #Connect to PNP Online
     Connect-PnPOnline -Url $SiteURL -Credentials $Cred
     
     #Get All Site collections 
     $SitesCollection = Get-PnPTenantSite
     
     #Loop through each site collection
     ForEach($Site in $SitesCollection) 
     { 
         Write-host -F Green $Site.Url 
         Try {
             #Connect to site collection
             Connect-PnPOnline -Url $Site.Url -Credentials $Cred
     
             #Get all subsites in site collection
             $SubSites = Get-PnPSubWebs -Recurse
             ForEach ($web in $SubSites)
             {
                 Write-host `t $Web.URL
                 Try{
                 $Lists = Get-PnPList 
                  ForEach($list in $Lists){
                      #Disable the modified column friendlyformat
                      Set-PnPField -List $list -Identity "Modified" -Values @{FriendlyDisplayFormat=1}
                          
                     }
                    }
                 Catch {
                 write-host -f Red "`tError:" $_.Exception.Message
                   }          
             }
         }Catch {
             write-host -f Red "`tError:" $_.Exception.Message
         }
     }
 }Catch {
     write-host -f Red "Error:" $_.Exception.Message
 }

More information for your reference:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.datetimefieldfriendlyformattype?view=sharepoint-csom

https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnpfield?view=sharepoint-ps


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.