开发者

Sharepoint GetListItems with a query not returning results

When I call GetListItems with the following Query:

<Query>
    <Where>
        <Contains>
            <FieldRef Name="Author"/>
            <Value Type="Text">Bob</Value>
        </Contains>
    </Where>
</Query>;

I get back a list with one row like this:

<z:row ows_ID="411" .... ows_ClientID="string;#7779" ... />

But, when I call the same list, but with this query:

<Query>
    <Where>
        <Eq>
            <FieldRef Name="ClientID"/>
            <Value Type="Number">7779</Value>
        </开发者_如何学运维Eq>
    </Where>
</Query>;

I get back no rows:

<GetListItemsResponse ...>  
    <GetListItemsResult ...>    
        <listitems ...> 
            <rs:data ItemCount="0" ....

Anyone have any idea why I'm not getting back that same row?


Because string;#7779 is clearly not 7779 nor does it claim to be a numeric type ;-)

Anyway, try:

  1. <Value Type='Calculated'>string;#7779</Value> (see comment) or;
  2. <Value Type='Text'>7779</Value> (note not "Number")

Happy coding.


Protip: Use the U2U CAML Query Builder to speed up "finding the quirks".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜