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

Hernando Gomez 1 Reputation point
2021-10-14T14:46:59.727+00:00

140652-image.png

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,621 questions
{count} votes

3 answers

Sort by: Most helpful
  1. JoyZ 18,041 Reputation points
    2021-10-15T07:55:46.023+00:00

    @Hernando Gomez ,

    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)

    --------------------------------------------Update version----------------------------------------------------------

    #Set Variables  
    $SiteURL = "https://tenant.sharepoint.com/"  
       
    #Get Credentials to connect  
    $Cred = Get-Credential  
       
      
        #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   
             
                #Connect to site collection  
                Connect-PnPOnline -Url $Site.Url -Credentials $Cred  
       
                #Get Site Collection administrators of the site  
                $SubSites = Get-PnPSubWeb -Recurse  
                ForEach ($web in $SubSites)  
                {  
                    #Write-host `t $Web.URL   
                    #Connect to web  
                    Connect-PnPOnline -Url $web.URL -Credentials $Cred  
                    $Lists = Get-PnPList | Where {$_.Hidden -eq $false -and $_.Title -ne 'Style Library'}  
                    ForEach($list in $Lists){  
                    #Write-host -F White $list.Title  
                    #Disable the modified column friendlyformat  
                    Set-PnPField -List $list -Identity "Modified" -Values @{FriendlyDisplayFormat=1}	   
                }  
           	}  
                     
            }  
    

    More information for your reference:

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

    https://learn.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.



  2. Hernando Gomez 1 Reputation point
    2021-10-27T09:42:40.547+00:00

    @JulieWang-MSFT

    I tried the script and it runs without any error, but nothing was change, still showing Display format friendly.
    Or this only works for new site?

    We have a tenant that has more than a hundred sites and we need to have it as Standard format .
    Doing it manually to standard format it works and looks like this below:
    Standard format:
    144163-image.png

    current format (friendly format)

    144193-image.png


  3. Hernando Gomez 1 Reputation point
    2021-10-28T10:13:10.05+00:00

    @JulieWang-MSFT we tested the script on account without MFA and it runs but no change.
    Note: Admin account has access to all sites and it shows green but when we check the sites still showing the same friendly display format.
    144525-image.png