Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-PSSnapin "Microsoft.SharePoint.PowerShell"
- $webUrl = "http://acme.local/site/ss/"
- $listtName = "Some List"
- $w = get-spweb $webUrl
- $l = $w.Lists.TryGetList($listtName)
- $spQuery = New-Object Microsoft.SharePoint.SPQuery
- $spQuery.ViewAttributes = "Scope='Recursive'";
- $spQuery.RowLimit = 4900
- $caml = "<Where><Neq><FieldRef Name='_ModerationStatus'/><Value Type='ModStat'>0</Value></Neq></Where>"
- $spQuery.Query = $caml
- $ii = $l.GetItems($spQuery)
- $ii | % {
- $i = $_
- if($i.ModerationInformation -ne $null){
- $i.ModerationInformation.Status = [Microsoft.SharePoint.SPModerationStatusType]::Approved
- $i.ModerationInformation.Comment = 'Automatically Approved'
- $i.Update()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement