使用CAML过滤出错,请大家指正

wklucky715 2012-03-14 06:55:52
Server Error in '/' Application.

One or more field types are not installed properly. Go to the list settings page to delete these fields.

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: Microsoft.SharePoint.Client.ServerException: One or more field types are not installed properly. Go to the list settings page to delete these fields.

Source Error:


Line 141:
Line 142: ctx.Load(ret);
Line 143: ctx.ExecuteQuery();
Line 144:
Line 145: GlobalFunctions.CacheHelper.Set(key, ret);

Source File: E:\Harbour Plaza\Developement\HPProject\HPBLL\SPHelper.cs Line: 143

Stack Trace:

[ServerException: One or more field types are not installed properly. Go to the list settings page to delete these fields.]
Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) +2167
Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() +1049
HP.BLL.SPHelper.GetWebListItems(String hotelName, String webListTitle) in E:\Harbour Plaza\Developement\HPProject\HPBLL\SPHelper.cs:143
ASP.mobile_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in e:\Harbour Plaza\Developement\HPProject\HPMobile\Mobile.master:113
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +246
System.Web.UI.Page.Render(HtmlTextWriter writer) +40
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5290

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
贴出代码:
var caml = new CamlQuery();
caml.ViewXml =
@"<View>
<Query>
<Where>
<And>
<Eq>
<FieldRef Name='DeleteFlag'/>
<Value Type='Text'>False</Value>
</Eq>
<Neq>
<FieldRef Name='_ModerationStatus'/>
<Value Type='Text'>0</Value>
</Neq>
</And>
</Where>
<OrderBy>
<FieldRef Name='Order0'/>
</OrderBy>
</Query>
</View>";
...全文
101 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wklucky715 2012-03-15
  • 打赏
  • 举报
回复
是因为我做了一个通用的方法,里面使用了CAML,但是并不是每个列表都有我要过滤的字段,所以出错了
wklucky715 2012-03-15
  • 打赏
  • 举报
回复
哦,谢谢,我已经找到答案了.
老猫五号 2012-03-15
  • 打赏
  • 举报
回复
感觉你的ModerationStatus应该是int型,Flag应该是Bool型,具体的列表设置你再看看,是不是你设置的Text类型,这个对应SharePoint的“单行文本”。
wklucky715 2012-03-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 lhqdyy9 的回复:]

应该是某个字段的类型不对导致的。推荐你个工具,U2U,你可以下载一下,然后构建你要的语句,看看和你想要的语句的差异在哪里。
[/Quote]

这些字段都是我循环打印出来的呀,
foreach (var field in fields)
{
Response.Write("字段名称:" + field.InternalName + "<br/>");
}
老猫五号 2012-03-14
  • 打赏
  • 举报
回复
应该是某个字段的类型不对导致的。推荐你个工具,U2U,你可以下载一下,然后构建你要的语句,看看和你想要的语句的差异在哪里。

3,245

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨 - LinyuLoveTJ
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧