2022 Developer Survey is open! Take survey.

Hot answers tagged

27 votes
Accepted

CAML Query, get item by lookup value, not by ID

Default lookup query uses the value instead of lookup Id The typical query looks like <Query> <Where> <Eq> <FieldRef Name='RefCountry' /> ...
user avatar
16 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><...
user avatar
10 votes
Accepted

Sharepoint REST API - Using caml query and select/expand to get lookup data

As far as I know it is not supported to apply $filter or $select expression for the endpoint: http://<sitecollection>/<site>/_api/web/lists(listid)/getItems(query) To summarize: CAML ...
user avatar
10 votes
Accepted

CAML query for current date

Replace <Geq> <FieldRef Name='vpux'/> <Value Type='Text'>" + dateNow + "</Value> </Geq> with <Geq> <FieldRef Name='vpux'/> <Value ...
user avatar
9 votes
Accepted

CAML Query Logics

Considered that Team and Department columns are text column. "<Query><Where>"+ "<And>"+ "<Or>"+ "<Or>"+ "<Eq&...
user avatar
  • 3,596
8 votes
Accepted

Adding 2 Caml queries in same executeQueryAsync

Yes you can, but you will have to load the list item collection seperately like below and call executequery once. clientContext.load(collListItem); clientContext.load(collListItem1);
user avatar
  • 8,769
8 votes
Accepted

CAML query OrderBy is not working

I think the problem is with including Query tag in your CAML. Just remove it. Here is a snippet that should work: <Where> <Eq> <FieldRef Name="Title" /> <Value Type="Text"...
user avatar
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&...
user avatar
  • 1,793
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 ...
user avatar
  • 1,698
7 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' /> ...
user avatar
  • 6,238
6 votes
Accepted

CAML Query for SPServices parameter

The trick is to set the CAMLQueryOptions so that you get all the items regardless of what folder they are in. It's sort of like the "folderless" option in a view's settings. CAMLQueryOptions: "<...
user avatar
6 votes
Accepted

Export contents of a sharepoint list to a html table

You can use SPServices jQuery Library and CAML query to get data from a SharePoint List and display that retrieved data in Content Editor Web Part where you would write your html table code. To learn ...
user avatar
  • 3,630
6 votes
Accepted

CAML query filtering is not working

Query in your case is a string, which means that you are using the SPList.GetItems(String[]) overload. That method accept a list of fields to load, not a query. You should be using one of the ...
user avatar
  • 6,854
6 votes
Accepted

CAML query using 'contains'

"<Query><Where>"+ "<Or>"+ "<Or>"+ "<Or>"+ "<Eq><FieldRef Name='UserName' ...
user avatar
  • 3,596
5 votes

Where can i download the U2U CAML query Builder for Sharepoint 2010?

U2U CAML Query Builder is now available again and updated for SharePoint 2013: http://www.u2u.be/Software You can also check out these alternatives: Stramit Caml Viewer SharePoint CAML Query ...
user avatar
  • 173
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 ...
user avatar
  • 1,944
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 ...
user avatar
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'>...
user avatar
  • 8,769
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 ...
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>
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 ...
user avatar
5 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"/&...
user avatar
  • 5,308
4 votes

CAML query limitation of values in IN operator

Can't comment due to low rep so posting as an answer, purists forgive. Breaking a 500 element In into several nested Or tags does not work, to my despair. The limit is 500 elements hard apparently. ...
user avatar
  • 41
4 votes

Building CAML query with AND and Order by Clause

I think that this code: <Eq> <FieldRef Name = "HomeType"><Value Type="Choice">Condo</FieldRef> </Eq> must be like that: <Eq> <FieldRef Name = "HomeType" /&...
user avatar
  • 275
4 votes
Accepted

getting length of list after caml query

Use following : var count = this.collListItem.get_count();
user avatar
  • 7,855
4 votes
Accepted

element for tomorrow CAML

When using you want to use the Offset=""(or according to the comments on MSDN attribute should be OffsetDays="") on the Element <View> <Query> <Where> <...
user avatar
  • 1,004
4 votes

CAML query not working with dates no idea why

Have you tried using 'OffsetDays' instead of 'Offset'? <Today OffsetDays='-7'/>
user avatar
  • 41
4 votes

Getting Current time in CAML QUERY

You can use <Today /> tag to get current date , additionally if you add IncludeTimeValue='TRUE', it will get you current time. Try this: <Where> <Gt> <FieldRef ...
user avatar
  • 8,769
4 votes
Accepted

Sharepoint CAML Query IN operator

maybe a bug on FieldRef using ID or LookupId because of querying the list in this way <Where> <Or> <In> <FieldRef Name="COLUMN1"/> <Values> <...
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 ...
user avatar

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