Monday, November 23, 2015

Update date friendly format for all lists in a site collection

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$site= Get-SPWeb "SITEURL"
$ColumnName ="Modified"
foreach ($web in $site.Site.AllWebs)
    Write-Host "Updating Site: " $web.Title
    for ($i=0; $i -lt $web.lists.count; $i++)
        $list = $web.lists[$i]
        Write-Host $List.Title
            $column = $list.Fields[$ColumnName]
            $column.FriendlyDisplayFormat = [Microsoft.SharePoint.SPDateTimeFieldFriendlyFormatType]::Disabled
            Write-Host "Field type updated on: $($list.Title)"

No comments:

Post a Comment

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...