For your #1 point - see 
http://www.sharepoint-tips.com/2006/12/caml-queries-return-all-items-despite.html
I don't understand #3 - I always use the @ literal string directive with CAML, 
and never had a problem with it.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Trevor Andrew
Sent: Friday, 6 June 2008 8:19 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: CAML Query not filtering - Any suggestions

Hi All,

I should also add that omitting the surrounding  <Query></Query> tags also 
appeared to be essential ... So to be comprehensive, the things that got the 
CAML query going were:

1.       Removing the <Query></Query> tags in a CAML query with only a <Where> 
clause,

2.       Substituting single-quotes for double-quotes as literal delimiters in 
the CAML query, and

3.       Avoiding the use of the C# literal string @ directive in a string to 
be used as a CAML query.

I guess the thing that surprised me most was that when the <Where> clause is 
wrong, I got *all* of the items in the list, not *none* of the items in the 
list ... There's a gotcha to keep in mind when I'm seeing unusual behaviour in 
the future ...

Cheers,
Trevor Andrew

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Trevor Andrew
Sent: Friday, 6 June 2008 6:33 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: CAML Query not filtering - Any suggestions

Hi All,

Thank you so much for your help ... To CAML syntax that *seemed* to finally get 
things working is shown below:

            string queryCAML = "<Where><Eq><FieldRef Name='Title'/><Value 
Type='Text'>{0}</Value></Eq></Where>";

So it seems to combine two of the suggestions:

4.       Avoid the use of double-quote delimeters in the CAML query and

5.       Avoid the use of the C# literal string @ directive.

Many thanks for your help.

Cheers,
Trevor Andrew

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zakir Azeez
Sent: Friday, 6 June 2008 3:47 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: CAML Query not filtering - Any suggestions

I had the same sort of issue, for some reason it does not like XML in @"" style.

I changed from
@"<Query><Where><Eq><FieldRef Name='Title' /><Value 
Type='Text'>{0}</Value></Eq></Where></Query>";
to
"<Query><Where><Eq><FieldRef Name=\"Title\" /><Value 
Type=\"Text\">{0}</Value></Eq></Where></Query>";

________________________________
From: [EMAIL PROTECTED] on behalf of Paul Noone
Sent: Fri 6/6/2008 3:30 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: CAML Query not filtering - Any suggestions
It's possible your ASP escapes are being taken literally in the query.

You might also variations of:

@"<Query><Where><Eq><FieldRef Name='Title' /><Value 
Type='Text'>{0}</Value></Eq></Where></Query>";

and

@'<Query><Where><Eq><FieldRef Name="Title" /><Value 
Type="Text">{0}</Value></Eq></Where></Query>';


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Cosier
Sent: Friday, 6 June 2008 12:27 PM
To: listserver@ozMOSS.com
Subject: RE: [OzMOSS] RE: CAML Query not filtering - Any suggestions

Not sure, but maybe remove the <Query> element, probably not needed.  Also feel 
free to use single quotes instead of doubles to make the code cleaner.

Matthew Cosier
Readify | Dev Centre Lead
M: +61 401 932 250 | E: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]> Blog: 
http://cosier.wordpress.com<http://cosier.wordpress.com/>

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Trevor Andrew
Sent: Friday, 6 June 2008 12:22 PM
To: listserver@ozMOSS.com
Subject: [OzMOSS] RE: CAML Query not filtering - Any suggestions

Hi All,

I have a CAML query, which I'm building in U2U CAML's builder - when I test it 
in CAML Builder, it returns the one custom list item I'm seeking. The CAML 
generated is shown below:

<Query><Where><Eq><FieldRef Name="Title" /><Value 
Type="Text">ABC</Value></Eq></Where></Query>

But when the query is executed using the following code, I get all of the items 
in the list returned:

                SPList configurationList = 
thisList.ParentWeb.Lists[configurationListName];
                SPQuery getConfigurationValueQuery = new SPQuery();
                queryCAML =
                    @"<Query><Where><Eq><FieldRef Name=""Title"" /><Value 
Type=""Text"">{0}</Value></Eq></Where></Query>";
                getConfigurationValueQuery.Query = string.Format(queryCAML, 
configurationValueName);
                SPListItemCollection configurationValues = 
configurationList.GetItems(getConfigurationValueQuery);

I've verified that the string format substitutes the correct value into the 
CAML query ...

Any suggestions kindly welcomed ...

Cheers,
Trevor Andrew

------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com
________________________________
____________________________________________________________________________
This e-mail is intended for the use of the addressed recipient(s) only and may 
contain confidential and privileged information. If you have received this 
message in error, please delete the message and any attachments and copies 
immediately; and notify the sender by return e-mail.

Any views expressed in this message or any attachments are those of the 
individual sender and do not necessarily represent the corporate opinion of the 
Catholic Education Office (CEO), Sydney.

The CEO Privacy Policy is located at http://www.ceo.syd.catholic.edu.au
____________________________________________________________________________
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com

------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com



------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com

Reply via email to