"In" operator

Aug 30, 2011 at 9:40 PM

Have just stumbled upon CAML In operator. Looks like it is missed in Camlex, isn't it?

Meanwhile, it is a very promising one and I believe it would often (but not always, of course) allow to get rid of all this annoying WhereAny and WhereAll with their corresponding foreachs...

What is your input about this?

Coordinator
Aug 31, 2011 at 7:15 PM

Hi omlin,

IN operator is available starting from Sharepoint 2010. If we will introduce it we will lost compatibility with Sharepoint 2007. From other point of view such position prevents evolution of the Camlex. E.g. there is also request about adding of Taxonomy fields support in Camlex. I thought about idea to split releases for 2007 and 2010 versions (fortunately Camlex is on mercurial now and it supports multi branching with merging very well) - e.g. like in WSPBuilder it was done. What do you think about it?

Sep 1, 2011 at 10:47 AM
Edited Sep 1, 2011 at 10:48 AM

Sounds reasonable, such a brilliant project certainly should move forward and aim to inject into the Microsoft.SharePoint namespace :)

Btw, the other new CAML operators in SharePoint 2010 are Includes and NotIncludes. And as I noticed, the Membership is not supported too at the moment, despite of it is available in both 2010 and 2007.

I think that would be a very proper direction of project evolution, to implement all the existing SharePoint features, I mean allow to use them without any workarounds, postreplacing or whatever (rather ugly, to be honest).

By now, unfortunately, despite of rather long period of development, I reckon Camlex.Net still fits mostly very basic needs... :(

Feb 13, 2012 at 3:24 PM
Edited Feb 13, 2012 at 3:28 PM

As release 3.1 still doesn't support these operators I am wondering how I would go about simulating e.g. Includes in Camlex. I've looked through the documentation for SharePoint 2007 and it's not clear if it was even possible to query in a similar way:

Includes from SharePoint 2010 documentation:
If the specified field is a Lookup field that allows multiple values, specifies that the Value element is included in the list item for the field that is specified by the FieldRef element.

Should I inject the <Includes> tag into the output of Camlex (ToCaml)?

Coordinator
Feb 14, 2012 at 9:25 AM

yes these constructions are not in Camlex yet. As workaround you can inject them by linq 2 xml (mentioned ToCaml) or simple string replacing (in the last case add some dummy expression in order to get correct CAML tree with all And and Or, and then replace it with your own). I would also try to use Lookup as string and use string.Contains() method (which is translated to Contains element) - but not sure that it will work.

Coordinator
Jun 15, 2013 at 9:00 PM
Nov 7, 2013 at 11:01 AM
How to make In operator for Taxonomy field ?

For Lookup fields it must contain Lookup="TRUE" definition.

For example: <FieldRef Name="TaxonomyField1" Lookup="TRUE" />
Coordinator
Nov 10, 2013 at 6:49 PM
umike,
possibility to add LookupId (as far as I understand you meant LookupId, not Lookup) for IN operation is not implemented yet. It is in the queue (https://camlex.codeplex.com/wikipage?title=Future%20improvements&referringTitle=Documentation), there were already requests for it. There are 2 workarounds at the moment:
  • add it with string.Replace() on resulting string, which you get from Camlex;
  • use XElement representation of the query (see ToCaml() method) and add attribute via object model.