0
StringBuilder xmlString = new StringBuilder(
    "<QueryPacket xmlns='urn:Microsoft.Search.Query'>"
    + "<Query><SupportedFormats><Format revision='1'> urn:Microsoft.Search.Response.Document:Document"
    + "</Format></SupportedFormats><Context>"
    + " <QueryText language='en-US' type='FQL'>");

// this adds the search free form text 
xmlString.Append("Earth");
query.Append(
    "</QueryText></Context>"
    + "<Properties>"
    + "<Property name='Name'/>"
    + "<Property name='Department' />"
    + "<Property name='Property1' />"                
    + "<Property name='Property2' />"
    + "<Property name='Property3' />"
    + "<Property name='Property4' />"
    + "<Property name='Property5' />"
    + "</Properties>"
    + "<Where>"
    + "<IsNotNull><FieldRef Name='Name'></FieldRef></IsNotNull>"
    + "<And><IsNotNull><FieldRef Name='Property1'></FieldRef></IsNotNull></And>"
    + "</Where>"                                       
    + "</Query></QueryPacket>"
);

QueryServiceSoapClient.QueryEx(query)

我在 Name 和 Property1 列上获取空值/空值的数据。为什么哪里不工作?

4

3 回答 3

2

It looks like your where clause is not properly formatted as @Damith suggested. Why dont you build your query using FAST Search for Sharepoint MOSS 2010 Query Tool. Its really quick and efficient way to work on this kind of tasks.

于 2013-05-17T10:02:00.357 回答
0
+ "<And><IsNotNull><FieldRef Name='Property1'></FieldRef>"+"</IsNotNull>And>"

IsNotNull您丢失后的这一行中,</因此该行应该是

+ "<And><IsNotNull><FieldRef Name='Property1'></FieldRef>"+"</IsNotNull></And>"
于 2013-05-17T09:06:58.157 回答
0

您的问题是您将<and>条款放在错误的位置。

它应该如下所示:

 <Where>
    <And>
        <IsNotNull>
            <FieldRef Name='Name'>
            </FieldRef>
         </IsNotNull>
         <IsNotNull>
             <FieldRef Name='Property1'></FieldRef>
         </IsNotNull>
    </And>
</Where> 

我知道,必须放置 and 子句是一个奇怪的地方,但这就是 CAML 的工作原理。如果您要使用 CAML 而不是 Linq,我强烈建议您使用CAMLQueryHelper 之类的程序。

于 2013-05-21T19:50:28.113 回答