Skip to main content
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
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,556
6 votes
Accepted

CAML query using 'contains'

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

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
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

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
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

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

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.9k
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.8k
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
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,656
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

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
3 votes

CAML Query not ordering, returns all items

The ViewXml you have does not conform to the XML schema it expects. It should have a <View> tag and a <Query> tag: $query.ViewXml = "<View><Query><OrderBy><FieldRef ...
Evariste's user avatar
  • 9,731
3 votes
Accepted

CSOM: fetching items using ViewFields and non-default properties

It turns out that by putting my two calls to the Load method one after the other, I could retrieve the columns and then the further attributes. I still don't understand why this can't be done in a ...
sasfrog's user avatar
  • 314
3 votes

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

<Query> <Where> <Eq> <FieldRef Name="UserName"/> <Value Type='Integer'><UserID Type='Integer'/></Value> </Eq> </Where&...
Christoffer's user avatar
  • 9,821
3 votes
Accepted

CAML Query to Get Single List Item Failing

You have missed <Eq></Eq> try following query <View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>234</Value></Where></...
Akshay Belure's user avatar
3 votes
Accepted

CAML query incorrectly returns all items

You are missing View as the root element in the CAML query. It should be: var camlQuery = @"<View> <Query> <Where> <Eq&...
Per Jakobsen's user avatar
  • 32.4k
3 votes

CAML query cant read serverrelatedURL with special character

Encode the values: encodeURIComponent('listname') in javascript Uri.EscapeUriString("listname") in C#
Deepmala's user avatar
  • 1,857
3 votes
Accepted

How to get all documents in given Documents Set in SP2016 using JSOM?

The folderServerRelativeUrl doesn't seem to be properly created. Suppose you have a site at /sites/yoursite Url containing a library named TestLib with a folder TestFolder, then the ...
Nadeem Yousuf-AIS's user avatar
3 votes
Accepted

Get the list specific rows from sharepoint where value exist

You need to loop through the List of string to build dynamic CAML query and apply filter on it... Below might help to give you an idea List<string> guidlist = new List<string>(); // ...
Siddharth Vaghasia's user avatar

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