Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Sharepoint列表名称和文档库名称之间存在冲突_C#_Sharepoint 2010 - Fatal编程技术网

C# Sharepoint列表名称和文档库名称之间存在冲突

C# Sharepoint列表名称和文档库名称之间存在冲突,c#,sharepoint-2010,C#,Sharepoint 2010,我有一个名为“人员列表”的列表和一个名为“人员”的Wiki页面库。我已经创建了一个可视化Web部件来显示人员列表中的数据。我已创建Web部件属性以读取listname。我的可视Web部件的Web部件属性名称为“People”。当我使用以下函数检查我的站点中是否存在列表时,它返回true:- public static bool isListExists(SPWeb spWeb, string listName) { return spWeb.Lists.

我有一个名为“人员列表”的列表和一个名为“人员”的Wiki页面库。我已经创建了一个可视化Web部件来显示人员列表中的数据。我已创建Web部件属性以读取listname。我的可视Web部件的Web部件属性名称为“People”。当我使用以下函数检查我的站点中是否存在列表时,它返回true:-

 public static bool isListExists(SPWeb spWeb, string listName)
        {
            return spWeb.Lists.TryGetList(listName) != null;
        }
但在我的网站上没有名为“人”的列表。只有名为“人”的wiki页面库存在。当我在“MySite/People/default.aspx”页面中添加我的Web部件时,出现了错误

Column 'Title' does not exist. It may have been deleted by another user.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Column 'Title' does not exist. It may have been deleted by another user.
Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 


[ArgumentException: Column 'Title' does not exist. It may have been deleted by another user.]
   Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException) +26422968
   Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) +47
   Microsoft.SharePoint.SPListItem.get_Item(String fieldName) +12
   CL.DanceStudio.Portal.CLDance_Instructor.<>c__DisplayClass3.<Select>b__1() +1155
   Microsoft.SharePoint.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2() +729
   Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) +27491206
   Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) +27194345
   Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) +93
   CL.DanceStudio.Portal.CLDance_Instructor.CLDance_InstructorUserControl.Select() +291
   CL.DanceStudio.Portal.CLDance_Instructor.CLDance_InstructorUserControl.Page_Load(Object sender, EventArgs e) +52
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42
   System.Web.UI.Control.OnLoad(EventArgs e) +132
   System.Web.UI.Control.LoadRecursive() +66
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +350
   CL.DanceStudio.Portal.CLDance_Instructor.CLDance_Instructor.CreateChildControls() +194
   System.Web.UI.Control.EnsureChildControls() +146
   System.Web.UI.Control.PreRenderRecursiveInternal() +61
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
列“标题”不存在。它可能已被其他用户删除。
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。
异常详细信息:System.ArgumentException:列“标题”不存在。它可能已被其他用户删除。
源错误:
在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别。
堆栈跟踪:
[ArgumentException:列“标题”不存在。它可能已被其他用户删除。]
Microsoft.SharePoint.SPFieldCollection.GetField(字符串strName,布尔bThrowException)+26422968
Microsoft.SharePoint.SPListItem.GetValue(字符串strName,布尔bThrowException)+47
Microsoft.SharePoint.SPListItem.get_项(字符串字段名)+12
CL.DanceStudio.Portal.CLDance_讲师.c__显示类3.b__1()+1155
Microsoft.SharePoint.c_u DisplayClass4.b_u 2()+729
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)+27491206
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode,对象参数)+27194345
Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(Code或Unelevated secureCode)+93
CL.DanceStudio.Portal.CLDance_讲师.CLDance_讲师用户控件。选择()+291
CL.DanceStudio.Portal.CLDance_讲师.CLDance_讲师用户控件.Page_加载(对象发送方,事件参数)+52
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,对象o,对象t,事件参数e)+25
System.Web.Util.CallEventHandlerDelegateProxy.Callback(对象发送方,EventArgs e)+42
System.Web.UI.Control.OnLoad(EventArgs e)+132
System.Web.UI.Control.LoadRecursive()+66
System.Web.UI.Control.AddedControl(控件控件,Int32索引)+350
CL.DanceStudio.Portal.CLDance_讲师.CLDance_讲师.CreateChildControls()+194
System.Web.UI.Control.ensureChildControl()+146
System.Web.UI.Control.PreRenderRecursiveInternal()+61
System.Web.UI.Control.PreRenderRecursiveInternal()+224
System.Web.UI.Control.PreRenderRecursiveInternal()+224
System.Web.UI.Control.PreRenderRecursiveInternal()+224
System.Web.UI.Control.PreRenderRecursiveInternal()+224
System.Web.UI.Control.PreRenderRecursiveInternal()+224
System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+3394

我认为这是因为名字冲突。请为我提供一个解决方案。

您为函数指定的列表名是什么?我在webpart属性中指定了“人”作为列表名。所以“People”是传递给函数的列表名。People列表是否有一个名为Title的列?是的。我正在sharepoint列表中使用默认标题列。