Tag Info

Hot answers tagged

23

CAML Designer The one that works is this URL: http://sharepoint.biwug.be/CamlDesigner/CamlDesigner.zip The link comes from Karine Bosch's Blog. CAML Designer is the successor of CAML Builder, and from experience I can tell you this tool is much better and accurate. I've tried the both. CAML Builder But if you want the previous tool, the page to turn to ...


12

Try to use this caml: <Where> <Eq> <FieldRef Name="Author" LookupId="True" /> <Value Type="User">123</Value> </Eq> </Where> this also might work, but first is preferable: <Where> <Eq> <FieldRef Name="Author" LookupId="True" /> <Value Type="Lookup">123</Value> ...


9

It is more a caml question than an SPServices question. Often one uses or and and operators to combine multiple values, which, like @rjcp3 said, can be messy. There is another operator, less known, IN operator to choose a range of values (see the xml example below). To simplify the creation of CAML queries in javascript, I'd recommend SharePoint ...


9

First of all you should just rule out the use of SQL. You should not use SQL directly against SharePoint content databases. If you ever do modifications directly using SQL that SharePoint Farm becomes unsupported for ever. Even just doing reads makes your SharePoint Farm unsupported as long as they are occuring and may cause any kind of problems as ...


9

<OrderBy> <FieldRef Name='Region' Ascending='True' /> <FieldRef Name='Location' Ascending='True' /> </OrderBy> Should be the correct syntax for the order by clause.


9

CAML queries are NOT vulnerable to SQL injection. I don't think you'll find any direct reference or proof. Consider that the conversion from CAML to SQL all happens between the data layer and the SharePoint API. You can't control how SharePoint generates the SQL for a given CAML statement and therefore you don't have to worry about SQL injection. That's ...


7

It sure looks so from your story, but isn't there a quite easy workaround for this? <Where> <Or> <In> <FieldRef Name="ID" /> <Values> <Value Type="Number">1</Value> <Value Type="Number">2</Value> . . . <Value ...


6

Yes, it's your nesting. Try this: <Where> <And> <Eq><FieldRef Name="Status" /><Value Type="Text">A</Value></Eq> <And> <Eq><FieldRef Name="Region" /><Value Type="Text">B</Value></Eq> <And> <Eq><FieldRef Name="BagVal" /><Value ...


6

Try this: <OrderBy> <FieldRef Name="ID" Ascending="TRUE"/> </OrderBy> <Where> <And> <Eq> <FieldRef Name="HomeType"><Value Type="Choice">Condo</Value></FieldRef> </Eq> <Eq> <FieldRef Name="LastName"><Value Type="Text">Doe</Value></FieldRef> ...


6

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 overloads that accepts an actual SPQuery object.


5

You should use the Internal Name of the column, so its probably: Link_x0020_to_x0020_Page Easy way to check the internal name is from the url when you edit the column, and check the "Field=" part of the URL: FldEdit.aspx?List=%7B6045095F%2DC5AF%2D47D5%2DA481%2D27665B46E343%7D&Field=Link%5Fx0020%5Fto%5Fx0020%5FPage Replace %5F with underscore, or ...


5

One oddity about the JSOM is that you need to wrap the CAML query in a <View> tag. var proproductIDVal = "TR543A1Z"; var queryXml = "<View><Query><Where><Eq><FieldRef Name = 'ProjectID'/><Value Type='Text'>" + productIDVal + "</Value></Eq></Where></Query></View>"; var query = new ...


5

Try this: splist li = web.lists["Films"]; spquery q = new spquery(); q.Query=""; //Enter a caml query here if you would like to restrict your results... q.ViewFields = string.Concat( "<FieldRef Name='FilmID' />", "<FieldRef Name='FilmName' />", ...


4

To achieve this, You can use ListItemCollectionPosition property. It is used together with the RowLimit property to define paging in a query. For your reference, see the sample code available this link http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.listitemcollectionposition.aspx I hope this will resolve your problem.


4

<Where> <And> <Eq><FieldRef Name="IssueLOB" LookupId="TRUE" /><Value Type="Lookup">1</Value></Eq> <And> <Eq><FieldRef Name="IssueBucket" LookupId="TRUE" /><Value Type="Lookup">1</Value></Eq> <Eq><FieldRef Name="IssueStatus" LookupId="TRUE" /><Value ...


4

You have several options for your type attribute in your value element. You can use Boolean, Choice, Currency, DateTime, Guid, Integer, Lookup, Note, Text, User. These type attributes are required, and can't be omitted. As regards to performance, CAML itself is faster than say LINQ, which at first need to be converted to CAML and then query the database. ...


4

To solve this issue, just remove the <Query> and </Query> tags from the CAML query it should all work.


4

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


4

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> <Eq> <FieldRef Name="EventDate" /> <Value Type="DateTime"><Today OffsetDays="+1"/></Value> ...


4

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: "<QueryOptions><ViewAttributes Scope='RecursiveAll' /></QueryOptions>"; The GetListItems documentation on MSDN is a little light on these options. ...


4

Default lookup query uses the value instead of lookup Id The typical query looks like <Query> <Where> <Eq> <FieldRef Name='RefCountry' /> <Value Type='Lookup'>India</Value> </Eq> </Where> </Query> To query by ID you have o setup LookupId='TRUE' ...


4

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 Name='YourColumnName' /> <Value IncludeTimeValue='TRUE' Type='DateTime'><Today /></Value> </Gt> </Where>


3

Remove <Query> and </Query> from your string


3

What about approaching it from the other end of the solution? If users are clicking a link of some kind to get to this view (is it a data view web part?), you could use JavaScript (which can handle date offsets relatively easily) to append a query string with the start date and end date of the range you need, and use both of those parameters in your CAML ...


3

Paging in SPQuery is implemented through the class SPListItemCollectionPosition. The SPListItemCollection returned by SPQuery.GetItems contains a ListItemCollectionPosition property which is null if no more pages and otherwise can be used assigned to the corresponding property in SPQuery before a new call to GetItems. (Sample at the link above)


3

If ArticlePriority is a choice column then null values will be sorted before the ones with values. One solution could be to create a hidden calculated column with the formular something like =IF(ArticlePriority=0,9999,ArticlePriority) and then order by that column


3

You should write query like below: <Where> <And> <Or> <Eq><FieldRef Name="X" /><Value Type="Text">A</Value></Eq> <Eq><FieldRef Name="X" /><Value Type="Text">B</Value></Eq> </Or> <Eq><FieldRef Name="X" /><Value ...


3

Yes definitely it will be faster, as less items will be retrieved and stored in memory. Here's sample code, public void SaveFolderFiles(string fileName, string libraryName, ClientOM.ClientContext clientContext) { ClientOM.List sharedDocumentsList = clientContext.Web.Lists.GetByTitle(libraryName); ClientOM.CamlQuery camlQuery = new ...


3

AssignedTo should be replaced with Author and you should then see all your items.


3

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 Helper Caml Designer for SP 2010 and SP 2013 CAML Generator (taken from my post on Stackoverflow)



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