Skip to main content
Share Your Experience: Take the 2024 Developer Survey
18 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><...
Robert Lindgren's user avatar
16 votes
Accepted

CAML query compare DateTime in UTC

Modify your CAML Query to <Value IncludeTimeValue='TRUE' Type='DateTime' StorageTZ='TRUE'>2018-06-28T07:07:09Z</Value> Here, we have added the StorageTZ=TRUE attribute which tells ...
Gautam Sheth's user avatar
  • 30.9k
15 votes
Accepted

CAML query format filter in DateTime column

You need to format the date like this: Server Site string date = SPUtility.CreateISO8601DateTimeFromSystemDateTime(inputDate); Sample for your case: inputDate = new DateTime(2016,04,18); string ...
Juan Pablo Pussacq Laborde's user avatar
15 votes
Accepted

Make CAML query with in rest api call

There are a lot of things to cover in your question. First, JSOM and REST are different things. JSOM is the JavaScript version of the Client Object Model. This is an API designed to be similar to the ...
Rob Windsor's user avatar
  • 12.7k
14 votes
Accepted

CAML Query - Going around the 5000 List Item Threshold

You cannot fetch the List items more than threshold limit. Ex: you have 10,000 items, there are 3000 item which meets your caml expression. you may think this is less than threshold limit, so it will ...
Suresh Bolineni's user avatar
10 votes
Accepted

Using CamlQuery in SharePoint 2010

First, The above code is Server-side object model, not Client Side object model so you should use Microsoft.SharePoint not Microsoft.SharePoint.Client namespace Second, the CamlQuery is used with ...
Mohamed El-Qassas MVP's user avatar
9 votes
Accepted

CAMl query to get all the listitems whose ID value in between 100 and 110 in SP 2010

You want to use Geq and Leq to be inclusive. Since you are using the ID column the type is actually Counter. <Query> <Where> <And> <Geq> <FieldRef Name='...
theChrisKent's user avatar
  • 6,021
8 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' /> ...
Anders Aune's user avatar
  • 6,268
8 votes
Accepted

How to query with 2 conditions? CamlQuery

If you want to compare with both conditions than use AND: @"<Where> <And> <Eq> <FieldRef Name='ReportsTo' /> <Value Type='Text'>" + reportsTo + @"</Value> ...
Hardik's user avatar
  • 7,733
8 votes

CAML query using OR and AND Condition

Placement of AND and OR in combine query always confuses us. The only mistake I see in your query is, you have miss placed the AND and OR elements. The correct query will be: <Query> <...
Trimantra Software Solution's user avatar
7 votes
Accepted

CamlQuery that traverses multiple folders

Based on your description, it's possible only If there is a relation between the first and second library. so you will be able to use List Join CAML Query to return the related data from two libraries ...
Mohamed El-Qassas MVP's user avatar
6 votes
Accepted

CAML query using 'contains'

"<Query><Where>"+ "<Or>"+ "<Or>"+ "<Or>"+ "<Eq><FieldRef Name='UserName' ...
Gaurravs's user avatar
  • 3,556
6 votes
Accepted

How to use a local variable in Caml Query? C#

Name Attribute is Optional Text that provides the internal name of the field that is referenced. So try to create a new variable that will hold the internal name of your field and set it via String....
Mohamed El-Qassas MVP's user avatar
6 votes

Using CAML Builder Is it possible to query the items from multiple list in SharePoint 2013?

It is not possible using Caml query builder tool U2U. you have to build your CAML Query as per below link : Using CAML Query to Retreive from Multiple Lists
SynozeN Technologies's user avatar
6 votes

CAML query using OR and AND Condition

Try this - I think this will do it. I have not tested it. <Query> <Where> <And> <Or> <Eq> <FieldRef Name='ProjectStatus' /> <Value Type='Choice'>Hold</...
mannaggia's user avatar
  • 999
5 votes
Accepted

How to query list with >5000 items in SharePoint Online?

Create a view in your list. Set a filter on the view to filter the data so the total number of items displayed in the view is less than the threshold, based on e.g. a date range, a number, by item id ...
Hardik's user avatar
  • 7,733
5 votes
Accepted

CAML query with ORDER BY is not working

Try adding Override="TRUE" in . Modified Code below: query += "<Where>"; query += "<IsNotNull>"; query += "<FieldRef Name='INDEX'/>"; query += "</IsNotNull>"; query += "</...
Alok Kumar Gupta's user avatar
5 votes
Accepted

Using CAML Builder Is it possible to query the items from multiple list in SharePoint 2013?

you can use SpsiteDataQuery. Also you can try to use OOTB content query web part. From Link above query.Lists = "<Lists><List ID='7A9FDBE6-0841-430a-8D9A-53355801B5D5' /><List ID='...
Mathew's user avatar
  • 1,386
5 votes
Accepted

Searching Criteria in SharePoint JSOM with the help of CamlQuery

In CAML Query, there is no possible criteria as LIKE, so you can use Contains or BeginsWith Look at this threads/article: SharePoint list CAML query using CONTAINS Using CAML "BeginsWith" in ...
Pradip R.'s user avatar
  • 2,297
4 votes

Using Date offset in CAML query

Marked answer won't work (at least in SP 2010) unless you change the Today Offset bit to "Today OffsetDays" thus having: <Where> <And> <Geq> <FieldRef Name='...
Jaime Arroyo Garcia's user avatar
4 votes

How to query list with >5000 items in SharePoint Online?

Using Client Object Model, You can query large list by using ListItemCollection Property ClientContext clientContext = new ClientContext("YOURURL"); List list = clientContext.Web.Lists.GetByTitle(“...
404's user avatar
  • 2,215
4 votes
Accepted

CAML query to filter Datetime

Try this : ---> createdDate.ToString("s")
Goshky's user avatar
  • 2,058
4 votes

Making an dynamic <And><Or> Caml Query

I had similar kind of requirement, below is the code which I have used previously: enum MergeType { Or, And }; private static string MergeCAMLConditions(List<string> conditions, MergeType type)...
Gaurav Vijh's user avatar
4 votes
Accepted

Query SharePoint List by multiple item IDs

There is a concept of IN Query in Sharepoint where you can use CAMl to hit with multiple conditions . Below is a code snippet where I've used it to create IN query for 1000 ID's. ...
Taran Goel's user avatar
  • 4,474
4 votes
Accepted

Exception from HRESULT: 0x80131904 Caml Query

I've found that multiple people have received the same error when using incorrect datatypes. So, after verifying the data types of the fields being queried directly in the Caml query, I noticed ...
Jason Eades's user avatar
4 votes
Accepted

Join 2 lists in SharePoint using CAML query

SPQuery query = new SPQuery(); query.Joins = "<Join Type='INNER' ListAlias='Documents'>" + "<Eq>" + "<FieldRef Name='e8_document' RefType='Id'/>" ...
Divya Sharma's user avatar
  • 1,461
4 votes
Accepted

Whats wrong in given caml query?

It works for my list. You just check the internal name of the fields StartDateTime and EndDateTime and date format mention in the value section in query 2017-03-23T12:00:00Z I think you mention Le ...
Suresh Bolineni's user avatar
4 votes

Whats wrong in given caml query?

The operators "Le" & "Ge" are not valid. It needs to either "Lt"/"Gt" (Less than/Greater than) OR "Leq"/"Geq" (Less than or Equal/Greater than or equal"). Also, it may be that, one would use "...
Alok Kumar Gupta's user avatar
4 votes
Accepted

CAML query to filter by more than one ID

I think the easiest way to build a query for an unknown number of IDs is to use the <In> operator. It's kind of like a multiple Or statement without having to nest all the Ors. You could do ...
Dylan Cristy's user avatar
  • 12.7k
4 votes
Accepted

How to query a list's user field for a given login name in Javascript?

You cannot use usernames in CAML queries to filter items based on the values of a Person field. You need to use either the full name or the id of the user. If you only have the username, then you ...
Mihail's user avatar
  • 2,079

Only top scored, non community-wiki answers of a minimum length are eligible