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><...
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 ...
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 ...
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 ...
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 ...
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 ...
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='...
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&...
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 + "</...
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' /> ...
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>
...
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>
<...
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
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 ...
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 ...
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. ...
6
votes
Accepted
CAML query using 'contains'
"<Query><Where>"+
"<Or>"+
"<Or>"+
"<Or>"+
"<Eq><FieldRef Name='UserName' ...
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....
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
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</...
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. ...
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
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
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'/>
</...
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 ...
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 += "</...
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='...
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 ...
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 ...
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='...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
caml-query × 953caml × 208
sharepoint-online × 164
javascript × 105
list × 98
sharepoint-enterprise × 85
development × 80
2010 × 60
sharepoint-server × 59
csom × 58
client-object-model × 57
2013 × 55
sharepoint-foundation × 55
spservices × 44
document-library × 31
jquery × 31
jsom × 31
sharepoint-designer × 30
spquery × 30
web-services × 25
sharepoint-addin × 23
powershell × 22
date-time × 21
sharepoint-rest-api × 20
web-part × 19