I need to make a Caml query to filter a list from content type AND for a specific value from a list. For example, a content type ID and a field value "English" from the column "languages" will get all the data/rows from the list with said content type and where languages is equal to "English".

So far I have this:

         `<View><ViewFields><FieldRef Name='BannerImageUrl' />
        <FieldRef Name='intraSubhead' /><FieldRef Name='FileLeafRef' /><FieldRef Name='Title' />
        <FieldRef Name='intraContentCategory' /></ViewFields>
        <BeginsWith><FieldRef Name='ContentTypeId'/>
        <Value Type='ContentTypeId'>${contentTypeId}  //I load the content type here

        <FieldRef Name="intraLanguages" />
         <Value Type="TaxonomyFieldType">${currentLanguage} // value like "English" and so on.


As seen above I try to do filter with content type and a value in a taxonomy field (intraLanguages). It doesn't work. Any help?

  • Are you getting any error? If yes, please post it to your question. Also I can see the error in your query. Ending tags are not closed properly. Commented Jun 4, 2019 at 6:40
  • Your XML is malformed!
    – phuzi
    Commented Feb 10, 2023 at 16:18

1 Answer 1


For Content Type:

You can add filter on Content Type using its name or Id as given below:

//Using Name of Content Type
    <FieldRef Name='ContentType'/>
    <Value Type='Computed'>YourCustomContentTypeName</Value>

//Using ID of Content Type
     <FieldRef Name='ContentTypeId' />
     <Value  Type='ContentTypeId'>YourContentTypeIdHere</Value>

For Managed Metadata field:

There are 2 methods to query a list/library that contains a managed metadata column:

  1. Query against Term Name
  2. Query Against WSSID

Method 1 (will look something similar to this):

 query.Query = @"<Where>
                      <FieldRef Name='" + MyTaxonomyFieldName + @"' />
                      <Value Type='Text'>" + tagName + @"</Value>


<Query><Eq><FieldRef Name=\"ManagedMetadata\"/><Value type=\"string\">brocoli</Value></Eq></Query>

Method 2:

query.Query = @"<Where>
                   <FieldRef LookupId='TRUE' Name='" + MyTaxonomyField + @"' />
                       <Value Type='Integer'>" + tagLookupID + @"</Value>

It is recommended to use the second method to avoid situations where the term name is used under different term groups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.