Friday, October 3, 2014

Content Approval on Multiple Lists

One of my colleague wanted to activate the Content Approval on a couple of lists and libraries within a site and we know that going to the settings of 25 libraries for the same setting is easy but a pain.

This can be done through Powershell.
Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$lists = @("Documents","New Documents","ListA")

$site=Get-SPSite $siteUrl

ForEach ($listName in $lists) 
        $list.EnableModeration = $false

        $MSG = $Now.ToString() +  " | Content Approval activated on list: " + $listName
        write-host $MSG
    catch [system.exception]
        $Now = [System.DateTime]::Now
        $MSG = $Now.ToString() +  "Exception: " + $_.Exception.Message
        write-host -f red $MSG