Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

CAML woes

  Asked By: Dario    Date: Mar 21    Category: Sharepoint    Views: 1047

I have a query that needs to filter out the items from a list where the
value of a choice field is equal to a certain value. The
listItemColletion I get after the filter is that of ALL items as if the
query has not been performed
Here's my code snip

String companyQuery = "<where>";
companyQuery += "<eq><fieldref name='Type'/><value
type='choice'>Company</value></eq>";
companyQuery += "</where><OrderBy><FieldRef Name='Company'/></OrderBy>";
SPQuery cQuery = new SPQuery();
cQuery.Query = companyQuery;
SPListItemCollection companyItems = lstContacts.GetItems(cQuery);

In the resulting list I get items that have a totally different value
than the one defined in the query.
What am I doing wrong here????

Share: 

 

3 Answers Found

 
Answer #1    Answered By: M Juarez     Answered On: Mar 21

I found the solution to my own problem with LOADS of trial and error.
Aparently SPQuery.query is case sensitive, but if you don't respect the
case, you do not get an error. The XML is correct, but the tags are not
recognised. As far as I can tell, you only get more or less (more the
"less" bit) relevant errors when the XML of the CAML query  is not
correct. Some errors simply tell you to try again.

 
Answer #2    Answered By: Marty Mcdowell     Answered On: Mar 21

I'm currently unaware of any kind of CAML debugger.

 
Answer #3    Answered By: Dakota Shaffer     Answered On: Mar 21

I was debugging in VS.Net.
The errors are thrown in the VS debugger. There are some CAML
editr/testers out there. The one I was using is from
http://blog.spsclerics.com/articles/607.aspx

 
Didn't find what you were looking for? Find more on CAML woes Or get search suggestion and latest updates.




Tagged: