0

I have a multi Folder/UniqueId column. I need to apply rest API filter on this column.

_api/Web/Lists/getbytitle('testList')/items?$filter=(Folder/UniqueId eq 'abctest')

Getting below exception.

{
    "odata.error": {
        "code": "-2146232832, Microsoft.SharePoint.SPException",
        "message": {
            "lang": "en-US",
            "value": "Column 'Folder' does not exist. It may have been deleted by another user."
        }
    }
}
1
  • What are you trying to do exactly? What is the name and data type of your column? And in REST APIs you need to use the internal name of your columns. – Ganesh Sanap Jun 11 '20 at 16:57
0

If your column name is Folder/UniqueId,the column internal name is Folder_x002f_UniqueId.

If the column is a multi text column,the value may not be the ‘testabc’,you could use “/_api/web/lists/getbytitle('listname')/items” to get all column value.

And the a multi text column can not use filter in rest, you need to call caml to filter .

Demo:

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>

function postJson(endpointUrl,payload,success,failure)
{
    $.ajax({
      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 = { 
       'query':{ 
           '__metadata': { 'type': 'SP.CamlQuery' },
           'ViewXml': queryViewXml
        } 
   }; 
   var endpointUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/getitems";
   postJson(endpointUrl,queryPayload,
     function(data){
        success(data.d.results);    
     },failure);
}
getListItems('Contents',"<View><Query><Where><Eq><FieldRef Name='Folder_x002f_UniqueId' /><Value Type='Note'>1</Value></Eq></Where></Query></View>",
  function(items){       
      for(var i = 0; i < items.length; i++) {
          console.log(items[i]);   
      }
  },
  function(error){
     console.log(JSON.stringify(error)); 
  });
</script>

Multi line text field in REST API filter url

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.