Sharepoint &引用;“操作无效”;尝试创建列表时

Sharepoint &引用;“操作无效”;尝试创建列表时,sharepoint,list,sharepoint-2010,Sharepoint,List,Sharepoint 2010,我想克隆Sharepoint中的列表。代码如下: private static void CloneList(SPList sourceList, string targetListName) { SPWeb web = sourceList.ParentWeb; web.AllowUnsafeUpdates = true; Guid targetListId; targetListId = web.Lists.Add(targetListName, sourc

我想克隆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
你知道怎么解决这个问题吗?(使用提升权限运行代码并不能解决问题)

试试这个

targetListId = web.Lists.Add(targetListName, sourceList.Description, SPListTemplateType.CustomGrid)
伟大的赫克勒