I have an query:


And it doesn't work. This error occurs:

The field 'text' of type 'Note' cannot be used in the query filter expression.

Is possible to filter by rich text column with REST API?


Apologies for previously erroneous and misleading answer

This is known issue. You cant filter data on rich text fields using $filter. It is present on 2013 On Premise and SharePoint online as well.

Doesnt matter if its plain text or enhanced rich text, this is unfortunately not allowed. I believe it could be for performance reasons.

So you need to use it conjunction with CAML query and make POST request to the SharePoint list.

The work around is to use is as below:

function postJson(endpointUrl,payload,success,failure)
      type: "POST", 
      headers: { 
            "accept": "application/json;odata=verbose",
            "content-type": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
      data: JSON.stringify(payload),
      url: endpointUrl, 
      success: success,
      failure: failure 

function getListItems(listTitle, queryViewXml,success,failure)
   var queryPayload = { 
           '__metadata': { 'type': 'SP.CamlQuery' },
           'ViewXml': queryViewXml
   var endpointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/getitems";

How to use it:

getListItems('Test',"<View><Query><Where><Contains><FieldRef Name='richTextColumn'/><Value Type='Note'>fddffd</Value></Contains></Where></Query></View>",
      for(var i = 0; i < items.length; i++) {

This works in both SP2013 and Online. Have tested this multiple times on both environments.

Sorry again for not giving a proper answer previously.

Reference - Using CAML with REST API


It is limitation in SharePoint REST API. There is work around for same is POST request or CAML query.

Please see below reference link for filter using richtext column.

Reference Link : REST API Limitations On Premise and Workarounds

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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