I am using SP2013 and trying to update the “Author” and “Editor” properties of a folder in a document library. When I run my script it appears that it updates the fields correctly, however, when I check the values again they are not actually modified. I am not sure why … Here is my existing script.
$web = Get-SPWeb “http://mytestbox/sites/tech/”
$site=$web
$list = $web.Lists[“Reports”]
foreach ($item in $list.Folders)
{
$itemauthor = $item[“Author”]
$itemeditor = $item[“Editor”]
$itemmod = $item.Properties.vti_modifiedby
write-host “Author is: ” $itemauthor
write-host “Editor is: ” $itemeditor
write-host “Modified By is: ” $itemmod
if($itemauthor -eq “1;#domainxyz\doveal”)
{
$itemauthor = “1;#sharepoint\system”
Write-Host “The folder author is ” $itemauthor
$item.Update()
Write-Host “The folder author is updated”
}
if($itemeditor -eq “1;#domainxyz\doveal”)
{
$itemeditor = “1;#sharepoint\system”
Write-Host “The folder editor is ” $itemeditor
$item.Update()
Write-Host “The folder editor is updated”
}
if($itemmod -eq “i:0#.w|domainxyz\doveal”)
{
$itemmod = “i:0#.w|sharepoint\system”
Write-Host “The folder modified by is ” $itemmod
$item.Update()
Write-Host “The folder modified by is updated”
}
write-host “Author is: ” $itemauthor
write-host “Editor is: ” $itemeditor
write-host “Modified By is: ” $itemmod
}
$site.Update()
$site.Dispose()
Â
maybe SharePoint 2013 is looking for more than one parameter to .Update(). If it doesn’t see both, it throws this error. Maybe try updating both Author and Editor and see what happens. This behavior isn’t present in my 2010 version (14.0.7113.5000)