English 中文(简体)
CAML 查询结果错误
原标题:CAML query returns wrong results?

I have the following code:

                    SPQuery oQuery = new SPQuery();
                    oQuery.Query = @"<Query>
                                           <Where>
                                              <And>
                                                 <Eq>
                                                    <FieldRef Name= PublishToSM  />
                                                    <Value Type= Boolean >1</Value>
                                                 </Eq>
                                                 <IsNull>
                                                    <FieldRef Name= SMUpdateDate  />
                                                 </IsNull>
                                              </And>
                                           </Where>
                                        </Query>";
                    SPListItemCollection collListItems = list.GetItems(oQuery);

                    NevCoSocialMedia.NevCoFacebook fb = new NevCoSocialMedia.NevCoFacebook();

                    foreach (SPListItem oListItem in collListItems)
                    {
                        if (oListItem.Fields.ContainsField("PublishToSM") && Convert.ToBoolean(oListItem["PublishToSM"]) == true)
                        {
.
.
.

我的问题是,为什么我需要最后的<代码>if说明? 如果我没有这样做的话,那就会出现一个错误,那就是,在试图填写时,该识别标志不存在。 这似乎是不可能的,因为我的非洲马列运动正在检查这一价值是否适当。

最佳回答

remove the "query" element

总结你的活动

问题回答

2. 将价值类型改为注入

<Eq>
    <FieldRef Name= PublishToSM  />
    <Value Type= Integer >1</Value>
</Eq>

http://www.commpointblues.com 201002/22/caml-and-querying-boolean-fields/

如果你不这样做,只能把国际发展法和所有权等基本领域填入返回的清单上。

我也曾遇到过使用Boolelean型号在一次cam问中度过的问题。 在我们的7个环境中,Boolean有6个工作被罚款,但其中1个没有工作,而且完全是我们的工作流程之一。 我们永远无法说明原因。

Try Integer或BitoSM油田,看你是否取得了不同的结果。





相关问题
SharePoint - Approaching Website Storage Limit Email

How can i go about changing the distribution list as well as the email text for the email that goes out to site collection admin when a site collection approaches it s size limit? Thanks for your ...

UI automated testing within SharePoint

I m looking for automated Functional Testing tools that can manipulate SharePoint sites, libraries, and documents thought the web interface. It needs to be extensible enough to handle any custom ...

Enable authorization on sitemap provider

I want to enable Authorization on the Site map provider. We have enabled anonymous access to the site and we want the Site map provider to be visible only to authorized users. I tried ...

SharePoint : web service permission error

I have a sharepoint site, and I am calling a standard sharepoint web service. I create the web service request like this : wsDws.Url = this.SiteAddress + @"/_vti_bin/Dws.asmx"; When I use ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签