17 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.7k
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.6k
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
  • 5,951
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&...
Shekar Reddy's user avatar
  • 1,793
8 votes
Accepted

Get the items in descending order using caml query

OrderBy should be outside of the Where clause. Try modifying your query to this: "<Where>" + "<Eq>" + "<FieldRef Name='TopicID' /><Value Type='Text'>" + ProjectID + "</...
Nadeem Yousuf-AIS's user avatar
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,258
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,723
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

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 ...
Yayati's user avatar
  • 1,728
7 votes
Accepted

How to retrieve list hyperlink field values?

Using JavaScript Object Model, if you need to retrieve value and link of a column of type Hyperlink then following methods are used. get_description(): It will fetch the description of the link you ...
Asad Refai's user avatar
  • 5,983
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

Do anyone know how to get item with most characters from a SP list using CAML query?

Add a calculated column to your list. Calculate the length of the field you want using LEN(Field) and return as number. This then boils down to just querying the calculated column using CAML query. ...
Akhoy's user avatar
  • 2,911
6 votes
Accepted

CAML query using 'contains'

"<Query><Where>"+ "<Or>"+ "<Or>"+ "<Or>"+ "<Eq><FieldRef Name='UserName' ...
Gaurravs's user avatar
  • 3,558
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

Query by contenttype with inheritance

Inherited content type IDs starts with parent content type id. You can use <Contains> condition with CAML and filter on ContentTypeId column pass the value of "LanguageItem" ctype ID. ...
Shekar Reddy's user avatar
  • 1,793
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 ...
ECM4D's user avatar
  • 1,962
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'>...
Unnie's user avatar
  • 8,809
5 votes
Accepted

CAMLQuery Comparison

You will need to add where condition and use <Today> token in your caml query. The query will be like as below <OrderBy> <FieldRef Name='StartDate' Ascending='True'/> </...
P S's user avatar
  • 4,827
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,723
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,376
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,299
4 votes
Accepted

Duplicate records while sorting list descending

Seems to me you have not a complete understanding of the logic you are trying to write? Let me give you an example of how your code works now: You have items 1 2 3 4 5 6 7 8 9 10 You retrieve them ...
Robert Lindgren's user avatar
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

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