This project is read-only.

Function
roboCAML.Query();

Functionality

This method will generate CAML strings for use in retrieving data from SharePoint.

 

Parameters (Properties)

Parameter Name Required
webURL No
listName (Display Name) *Yes*
closeCaml No
config *Yes*
OrderBy No
QueryOptions No
ViewFields No


 

 

 

 

 

 

 

config Properties

Property Name Required Implementation
filter *Yes* ~ see notes below correctCAML
op (operator) *Yes* correctCAML
staticName *Yes*
value *Yes* ~ see notes below
LookupId No  

config Property notes***

  1. filter - This is only required if more than one "op" is needed.  Look at the examples below for clarity.
  2. value - IsNull or IsNotNull does not require a value.  Also value can be passed as a number or string.
  3. LookupId - Only used when interacting with lookup fields and would like to use the ID instead of text within your value property.

 

Examples

roboCAML.Query({ 
	listName: "scripts", 
	config: [
		{ 
			op: "!=", 
			staticName: "ID", 
			value: 3 
		} 
	]
});

will generate this CAML fragment:

<Neq>
	<FieldRef Name='ID' />
	<Value Type='Counter'>3</Value>
</Neq>

Adding closeCaml to the call, will close the CAML correctly.  Since the CAML strings work differently for SPServices and ClientOM, you'll need to pass that in as your value.  Here's an example of that:

roboCAML.Query({ 
	listName: "scripts", 
	closeCaml: "ClientOM", 
	config: [ 
		{ 
			op: "!=", 
			staticName: "ID", 
			value: 3 
		} 
	]
});

This will generate this CAML string:

<View>
	<Query>
		<Where>
			<Neq>
				<FieldRef Name='ID' />
				<Value Type='Counter'>3</Value>
			</Neq>
		</Where>
	</Query>
</View>

 

If closeCaml: "SPServices" were to be passed into this method, the resulting CAML would look like this:

 

<Query>
	<Where>
		<Neq>
			<FieldRef Name='ID' />
			<Value Type='Counter'>3</Value>
		</Neq>
	</Where>
</Query>

roboCAML.Query Notes

Post your favorite queries made with roboCAML in this discussion thread.

Last edited May 11, 2012 at 1:06 PM by iOnline247, version 16

Comments

No comments yet.