Friday 23 May 2014

How can we set the New icon image for specific number of days beside documents in a document library?

We got a requirement where we need to display the new icon beside the documents for a specific duration of days.

The below powershell script will override the default duration

Add-PsSnapin Microsoft.SharePoint.PowerShell
$webappURL = Read-Host"Enter the webapplication url to set the duration for ex(https://test.com)"
$newIconDuration = Read-Host"Enter the duration"
if(($newIconDuration -ne null) -and ($webappURL -ne null))
{
$durationset = $webApp.DaysToShowNewIndicator
write-Host"current duration of new icon is"$durationset
$webApp = Get-SPWebApplication $webappURL
$webApp.DaysToShowNewIndicator = $newIconDuration
$webApp.Update()
write-Host"Successfully updated the duration of new icon"
}
else
{
write-Host"Please run the script with valid values"
}
Remove-PsSnapin Microsoft.SharePoint.PowerShell

No comments:

Post a Comment