开发者

Update SPList.Author in SharePoint

A user who created various lists in SharePoint Server 2010 has subsequently been deleted from the site collection. This leaves the user id in the SPList.Author property but results in "User cannot be found" messages in various places that try to instantiate the SPUser obj开发者_开发问答ect.

Is there any supported way to update the SPList.Author property? I have tried with the server OM, Client OM and lists.asmx web service and have failed with all three.


I've never done it before, but using this guide here, here is what you could try on Powershell:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$siteUrl = "your sharepoint site url"
$webName = "your webname"
$spSite = new-object Microsoft.SharePoint.SPSite($siteurl)
$spWeb = $spSite.OpenWeb($webName)
$listName = "your listname"
$userLoginName = "your username"

$spList = $spWeb.Lists[$listName]
$spList.Author = $spWeb.AllUsers[$userLoginName]
$spList.Update() // I don't know if this is required.


maybe find a way to remove the user from the sitecollection


I have accepted that it is not possible to update SPList.Author, but my need to do so has also weakened.

The reason I wanted to do this was the encountering of "user cannot be found" errors on the list settings and workflow settings pages. I thought that it may have been originating in the list - because tools like SharePoint manager show "user cannot be found" when I examine the list author property.

It turned out, however, to be coming from workflow templates, not lists, that had been published by the since-removed user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜