1

Resolved

CAML.Query missing

description

Hi John,
 
This looks like a great idea and since we are embarking on a project which plans to expose some SharePoint documents to the web I would like to use it. However I've just downloaded the latest release and add a reference to the DLL I get a strange error which tells me there is no Query method. I can't quite believe that something so fundamental could be missing from the build this so I'm assuming I've done something wrong. Have you come across this ? I've attached a screen shot - just to prove I'm not nuts.
 
Cheers
Scott

file attachments

comments

scottcable wrote Jul 1, 2007 at 11:19 PM

Sorry about the BMP I didn't realise the size when I posted it. I've attached a JPG of the same image.

wrote Jul 1, 2007 at 11:19 PM

jholliday wrote Jul 21, 2007 at 8:02 PM

Scott,

I removed the CAML.Query method to make the framework more type-safe when passing additional parameters, such as the list of fields you are interested in, and ordering or grouping of results. Here is how you might go about the query you were trying to create:

public partial class Document : System.Web.UI.Page { protected void GetData() { CamlQuery q = new CamlQuery( CAML.OrderBy(CAML.FieldRef("Site Name"), CAML.FieldRef("Job Number")) + CAML.Where(CAML.Eq(CAML.FieldRef("Document Type"), CAML.Value("Job Sheet"))) ); // ... Console.WriteLine(q); }

This produces the following query string:

<OrderBy><FieldRef Name="Site_x0020_Name" /><FieldRef Name="Job_x0020_Number" /></OrderBy><Where><Eq><FieldRef Name="Dobumenct_x0020_type" /><Value Type="Text">Job Sheet</Value></Eq></Where>

But it also lets you do things like this:

using (SPSite site = new SPSite("http://myserver/mysite")) { using (SPWeb web = site.OpenWeb()) { List<SPListItem> items = q.Fetch(web); }}

wrote Oct 21, 2007 at 4:06 PM

wrote Feb 14, 2013 at 2:26 AM

wrote May 16, 2013 at 8:39 AM

wrote May 16, 2013 at 8:39 AM

wrote Jun 14, 2013 at 7:03 AM