2
我想在Sharepoint中克隆列表。这是代码:尝试创建列表时“操作无效”
private static void CloneList(SPList sourceList, string targetListName)
{
SPWeb web = sourceList.ParentWeb;
web.AllowUnsafeUpdates = true;
Guid targetListId;
targetListId = web.Lists.Add(targetListName, sourceList.Description, sourceList.BaseTemplate);
// irrelevant stuff
}
在最后的代码行(Lists.Add()),我得到的错误
operation is not valid due to the current state of the object sharepoint 2010
任何想法如何做才能解决这个问题? (与elevatedPrivilegues运行的代码并不能解决问题)