Hot answers tagged

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
9 votes
Accepted

CAML Query Logics

Considered that Team and Department columns are text column. "<Query><Where>"+ "<And>"+ "<Or>"+ "<Or>"+ "<Eq&...
Gaurravs's user avatar
  • 3,558
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
6 votes
Accepted

CAML query using 'contains'

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

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 ...
Danny '365CSI' Engelman's user avatar
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

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 ...
Sylvain B's user avatar
  • 260
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>
Monica Jagani's user avatar
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 ...
Eric Alexander's user avatar
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 ...
Robert Kaucher's user avatar
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></...
Amal Hashim's user avatar
  • 28.3k
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 ...
Robert Lindgren's user avatar
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 ...
Edison Neza's user avatar
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='...
Hardik's user avatar
  • 7,733
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=\"...
Vadim Gremyachev's user avatar
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()...
Gautam Sheth's user avatar
  • 30.8k
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.6k
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 + ...
Damjan Tomic's user avatar
  • 3,626
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 ...
little_big_thoughts's user avatar
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>...
Robert Lindgren's user avatar
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 ...
Anders Aune's user avatar
  • 6,268
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 ...
Robert Lindgren's user avatar
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; ...
Akshay Belure's user avatar
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[...
Gaurav Vijh's user avatar
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 ...
Dikesh Gandhi's user avatar
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(){ ...
Sergei Sergeev's user avatar

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