1

I have following powershell. I am trying to update Created by (Author) for SSRS report library. I am changing disabled authors to sharepoint service account. The script runs without an error but there is no change in Author column.

if((Get-PSSnapin | Where {$_.Name -eq “Microsoft.SharePoint.PowerShell”}) -eq $null) {
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}

$web=get-SPWeb "http://analytics.insidenov.home/ssrs"
$list=$web.Lists["SSRS Reports"]
$CAML = '<Where>
              <Eq>
                 <FieldRef Name="Author" />
                 <Value Type="User">Cooper, Jim</Value>
              </Eq>
        </Where>'
$query = new-object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='Recursive'"
$query.Query = $CAML
$listitems = $list.GetItems($query)
write-host $listitems.count

foreach($item in $listitems)
{
  $item["Author"] = $web.EnsureUser("nov\svc_test_acct_rw")
  $item.update()
}
$web.dispose()
  • Btw, I manually change Author "ReadOnlyField" to False using SharePoint Manager 2010. and still not updating the list items with the new Author. – Monica Trevino Nov 4 '16 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.