Day to day Powershell, SharePoint, and Project Server experiences. Any scripts here are provided as-is, and you're encouraged to test them before you run them on production. Most are scripts I've altered to suit my needs, and come from places like Stack Overflow or TechNet.
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()
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment