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><...
9
votes
Accepted
CAML Query Logics
Considered that Team and Department columns are text column.
"<Query><Where>"+
"<And>"+
"<Or>"+
"<Or>"+
"<Eq&...
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' /> ...
6
votes
Accepted
CAML query using 'contains'
"<Query><Where>"+
"<Or>"+
"<Or>"+
"<Or>"+
"<Eq><FieldRef Name='UserName' ...
6
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"/&...
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
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
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
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 ...
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 ...
4
votes
CAML Query to retrieve list item by title
Query should be like
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>Test1</Value></Eq></Where></...
4
votes
Accepted
SP - CAML Query with three AND operators
You can not have more than 2 statements in every <And> / <Or> tag. Also you seem to be missing an <Eq> (or whatever you need) around your first <FieldRef> tag.
So instead do ...
4
votes
Getting this error: An entry without a type name was found, but no expected type was specified
When making a POST request, __metadata attribute isn't required if aren't passing the Accept:"application/json;odata=nometadata" header. If you are passing in a verbose header you would need to ...
4
votes
Multiple Lookup Columns return no items CAML Query SharePoint Views
You need to use below updated code as your CAML query.
SPQuery query = new SPQuery();
query.Query = "<Where><And><Eq><FieldRef LookupId='TRUE' Name='Program'/><Value Type='...
4
votes
Accepted
Trying to filter values to a People or group field that has multiple values. Tried Both CAML and REST
You could construct the following CAML query to return only the Teams that the current user is a member of:
<Or>
<Membership Type=\"CurrentUserGroups\">
<FieldRef Name=\"...
4
votes
Accepted
SharePoint 2013 Batch update list items C# SSOM
In your code you have set ID 833, so it will only update the item which has ID 833.
Modify your code as below:
using (SPSite spSite = new SPSite(siteName))
{
using (SPWeb spWeb = spSite.OpenWeb()...
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 ...
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 "...
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 ...
4
votes
Accepted
JS: If 'X' is mentioned anywhere in the LIST. Display
You should use <Contains> instead of <Eq> in your caml query:
var query = "<Query><Where><Contains><FieldRef Name='Category' /><Value Type='Text'>" + value + ...
4
votes
CAML Query Logics
You can easily create CAML queries if you use any of these s/w these are free to use and available in both install/offline packages. However, CAML query for your scenario would look like this.
Free ...
3
votes
Accepted
Caml Query not applying to my list requests
Please see this example from MSDN, you need to wrap with <View> tags, as shown below:
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq>...
3
votes
Empty CAML Query recursively search through document sets
Document sets are just "fanzy" folders, so you have to use scope RecursiveAll.
query.ViewXml = "<View Scope=\"RecursiveAll\" /> ";
Or simply use the CreateAllItemsQuery that sets the same caml ...
3
votes
SP - CodError with CAML query,
Here string myEndMil = myItemCol[0]["endMil"].ToString(); you are assuming you have gotten at least one result back. That might not be the case!
You should check first that myItemCol.Count > 0
...
3
votes
Accepted
Retrieve all documents from a view
Try Following code
SPList List = _site.Lists.TryGetList("ListName");
SPView view = List.Views["Name"];
SPQuery query = new SPQuery();
query.Query = view.Query;
...
3
votes
CAML query on special characters
You have to escape the special characters in XML. So you need to pass the value under CDATA object. Something like:
<Contains><FieldRef Name='Title' /><Value Type='Text'><![CDATA[...
3
votes
Accepted
SP Online - Get items from list(CAML) with JSOM
You need to put while loop for listItemEnumerator.
Try below code:
function getUserData() {
var employeeList = clientContext.get_site().get_rootWeb().get_lists().getByTitle('Служители');
var ...
3
votes
Accepted
How to fix CAMLJS undefined error?
Try to put your code inside SP.SOD.executeOrDelayUntilScriptLoaded block.
camljs uses some functions which are not availiable on document load.
SP.SOD.executeOrDelayUntilScriptLoaded(function(){
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
caml × 543caml-query × 208
sharepoint-online × 74
javascript × 71
list × 55
development × 49
2010 × 45
2013 × 43
csom × 42
sharepoint-enterprise × 40
query × 40
sharepoint-server × 29
client-object-model × 25
document-library × 23
sharepoint-foundation × 20
spservices × 19
rest × 17
powershell × 16
jsom × 16
sharepoint-designer × 14
list-view × 12
lookup-column × 12
filter × 12
jquery × 11
sharepoint-addin × 10