27
votes
Accepted
CAML Query, get item by lookup value, not by ID
Default lookup query uses the value instead of lookup Id
The typical query looks like
<Query>
<Where>
<Eq>
<FieldRef Name='RefCountry' />
...
16
votes
Accepted
Filter CAML Query by List Item ID
Modify
var camlQueryString = "<Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query>";
to
var camlQueryString = "<View><Query><Where><Eq><...
10
votes
Accepted
Sharepoint REST API - Using caml query and select/expand to get lookup data
As far as I know it is not supported to apply $filter or $select expression for the endpoint:
http://<sitecollection>/<site>/_api/web/lists(listid)/getItems(query)
To summarize:
CAML ...
10
votes
Accepted
CAML query for current date
Replace
<Geq>
<FieldRef Name='vpux'/>
<Value Type='Text'>" + dateNow + "</Value>
</Geq>
with
<Geq>
<FieldRef Name='vpux'/>
<Value ...
9
votes
Accepted
CAML Query Logics
Considered that Team and Department columns are text column.
"<Query><Where>"+
"<And>"+
"<Or>"+
"<Or>"+
"<Eq&...
8
votes
Accepted
Adding 2 Caml queries in same executeQueryAsync
Yes you can, but you will have to load the list item collection seperately like below and call executequery once.
clientContext.load(collListItem);
clientContext.load(collListItem1);
8
votes
Accepted
CAML query OrderBy is not working
I think the problem is with including Query tag in your CAML. Just remove it.
Here is a snippet that should work:
<Where>
<Eq>
<FieldRef Name="Title" />
<Value Type="Text"...
8
votes
Accepted
Caml Query to return items created by logged in user
var context = new SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle("ListName");
var cQuery = new SP.CamlQuery();
var camlXML = "<View&...
7
votes
Caml Query to return items created by logged in user
The Author column is of LookUp Type. Here is the complete list.
var ctx = new SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle("Vacation Replacement");
var query = new ...
7
votes
Accepted
camlQuery rowlimit not working on a list
SP.CamlQuery does not have a property RowLimit , you have to set in the caml markup:
camlQuery.set_viewXml("<View><Query> <OrderBy> <FieldRef Name='ID' Ascending='False' /> ...
6
votes
Accepted
CAML Query for SPServices parameter
The trick is to set the CAMLQueryOptions so that you get all the items regardless of what folder they are in. It's sort of like the "folderless" option in a view's settings.
CAMLQueryOptions: "<...
6
votes
Accepted
Export contents of a sharepoint list to a html table
You can use SPServices jQuery Library and CAML query to get data from a SharePoint List and display that retrieved data in Content Editor Web Part where you would write your html table code.
To learn ...
6
votes
Accepted
CAML query filtering is not working
Query in your case is a string, which means that you are using the SPList.GetItems(String[]) overload.
That method accept a list of fields to load, not a query. You should be using one of the ...
6
votes
Accepted
CAML query using 'contains'
"<Query><Where>"+
"<Or>"+
"<Or>"+
"<Or>"+
"<Eq><FieldRef Name='UserName' ...
5
votes
Where can i download the U2U CAML query Builder for Sharepoint 2010?
U2U CAML Query Builder is now available again and updated for SharePoint 2013:
http://www.u2u.be/Software
You can also check out these alternatives:
Stramit Caml Viewer
SharePoint CAML Query ...
5
votes
Accepted
Ignore Null Values in OrderBy Asc While creating CAML Query
Create a calculated column that would calculate if your sort column is not NULL. The formula could look like this =IF(ISBLANK([ColumnName]),0,1) and the result can be 'Yes/No'. Now you can make ...
5
votes
Accepted
Query multiple lists using javascript/CSOM
The OOP suggestion solves your context problem but it is kinda like saying:
We have a flat tire, lets change cars!
Your issue is with the this context you give to your processing function, so lets ...
5
votes
CAML Query Where (x AND y) OR Z
<Or> should be the outer one and <And> should be inside.
Try below:
<Where>
<Or>
<Eq><FieldRef Name='Name' /><Value Type='Text'>...
5
votes
Getting this error: An entry without a type name was found, but no expected type was specified
I think this occurs due to missing Type attribute in List Item entry.
If you want to create list items using REST you will need to include the list item type.
The list item type is a string ...
5
votes
Multiple Lookup Columns return no items CAML Query SharePoint Views
Your caml query should have <Value Type="Lookup">9</Value> instead of <Value Type="Integer">9</Value>
5
votes
Cannot Query Document Library with > 5K folders
In SharePoint Online, your only choice is to use REST. CSOM will not work. You call the REST endpoint and it will return a batch of 100 or 200 items, and if more exist, will return a paged link to ...
5
votes
CAML query list created date +2
You'll want to use the Greater than or Equal operator (Geq) and then use the Today element for relative comparison:
<Where>
<And>
<Eq>
<FieldRef Name="Status"/&...
4
votes
CAML query limitation of values in IN operator
Can't comment due to low rep so posting as an answer, purists forgive.
Breaking a 500 element In into several nested Or tags does not work, to my despair. The limit is 500 elements hard apparently.
...
4
votes
Building CAML query with AND and Order by Clause
I think that this code:
<Eq>
<FieldRef Name = "HomeType"><Value Type="Choice">Condo</FieldRef>
</Eq>
must be like that:
<Eq>
<FieldRef Name = "HomeType" /&...
4
votes
Accepted
getting length of list after caml query
Use following :
var count = this.collListItem.get_count();
4
votes
Accepted
element for tomorrow CAML
When using you want to use the Offset=""(or according to the comments on MSDN attribute should be OffsetDays="") on the Element
<View>
<Query>
<Where>
<...
4
votes
CAML query not working with dates no idea why
Have you tried using 'OffsetDays' instead of 'Offset'?
<Today OffsetDays='-7'/>
4
votes
Getting Current time in CAML QUERY
You can use <Today /> tag to get current date , additionally if you add IncludeTimeValue='TRUE', it will get you current time.
Try this:
<Where>
<Gt>
<FieldRef ...
4
votes
Accepted
Sharepoint CAML Query IN operator
maybe a bug on FieldRef using ID or LookupId because of querying the list in this way
<Where>
<Or>
<In>
<FieldRef Name="COLUMN1"/>
<Values>
<...
4
votes
SP2013 use Rest with CAML query and expand lookup column
You can't use $expand in conjunction with a CAML query. You'll either have to construct the your filter conditions using $filteror you will have to have another operation that performs the action of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
caml × 536caml-query × 202
javascript × 71
sharepoint-online × 68
list × 55
development × 50
2010 × 45
2013 × 44
csom × 43
sharepoint-enterprise × 40
query × 39
sharepoint-server × 28
client-object-model × 25
document-library × 23
sharepoint-foundation × 21
spservices × 19
rest × 18
jsom × 16
powershell × 15
sharepoint-designer × 14
list-view × 12
lookup-column × 12
filter × 12
jquery × 11
sharepoint-addin × 10