Tuesday, February 10, 2015

Notes on querying metadata in SharePoint 2013


CAML Query with Managed Metadata (quote):
Just use the field as you would any lookup, basing your query on the display value, not the ID. SharePoint will support any types of queries you can on a text field, such as equals, contains or begins with. So you can even enter just a couple of characters and receive search results! Something like this works great:
<where>
<contains>
<fieldref name="ManagedMetadata">
<value type="TaxonomyFieldType">My Value</value>
</fieldref>
</contains>
</where>

Managed MetaData “ampersand” values
Essentially, this works:
<Eq>
<FieldRef Name='MyTaxonomyField' />
<Value Type='TaxonomyFieldType'>Science \uFF06 Technology</Value>
</Eq>