Friday, March 18, 2016

Powershell to approve all items in a SharePoint list


This script will set all items in the list to Approved.  Handy if you've bulk updated a bunch of items than need to get them published.

add-pssnapin microsoft.sharepoint.powershell


#$site = new-object Microsoft.SharePoint.SPSite("http://somesite.com/news")

$web = get-spweb "http://somesite.com/news/2016/"
$list = $web.Lists["Pages to be Changed"]
$items = $list.Items
foreach ($item in $items)

{

$item["_ModerationStatus"] = 0
$item.Update()

}

No comments:

Post a Comment