If you execute an SPQuery through the SPList.GetItems(SPQuery) method and get all the items in the list, check the syntax in the Query property. The U2U CAML Query adds the tag <Query> to the query and it is not necessary in the Query property of SPQuery. For example: SPList list = new SPQuery query = new This code returns all items in the list, but if you remove the <Query> tag all works fine: SPList list = new SPQuery query = new Related Links:
SPSite("http://MySharePointSite").OpenWeb().Lists[listName];
SPQuery();
query.Query = "<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Test</Value></Eq></Where></Query>";
SPListItemCollection items = list.GetItems(query);
SPSite("http://MySharePointSite").OpenWeb().Lists[listName];
SPQuery();
query.Query = "<Query><Where><Eq><FieldRef Name="Title" /><Value Type="Text">Test</Value></Eq></Where></Query>";
SPListItemCollection items = list.GetItems(query);
http://joeshepherd.spaces.live.com/Blog/cns!9AE2097A4A610B63!123.entry
Tuesday, October 9, 2007
SPQuery returns all items
Publicado por
Àlex
en
5:39 AM
Subscribe to:
Post Comments (Atom)
10 comentarios:
Hi,
Delete from query text "Query" tag and recompile it.
Thanks for the help!
Thanks alot :), at first i really didn't understand why the query was working fine in U2U but not in actual code.
Beautiful......
Thanks a lot. In my case i had to remove 'Query' and 'View' tags to make it work.
Thanks, this really helped
Hi,
I have one small doubt, how can i show xml tags while posting. for example u have shown xml tags in ur poting query.Query = some xml tags
Thanks,
Surya.
Tnx, really helped
thanks. this saved me.
Thanks a lot!! I was going crazy with this issue!! Thanks Thanks Thanks :)
Post a Comment