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運行的代碼並不能解決問題)