Sharepoint - logical not of substringof() in 2013 REST API
It seems like there is a bug with substringof
operator in REST/OData web service implementation.
Symptoms
When applying substringof
operator to a list items using the following syntax:
/_api/web/lists/getbytitle('Contacts')/items?$filter=substringof('John', Title) eq false
an error occurs:
<m:error
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-1, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="en-US">The query is not valid.</m:message>
</m:error>
Workaround
You could target the listdata.svc
where substringof operator could be applied successfully.
Example:
/_vti_bin/listdata.svc/Contacts?$filter=substringof('Jane',LastName) eq false
The figure below shows the supported OData query options and how to specify supported filters
You can find the full documentation here.
The following Url is working fine at my end:
_api/web/Lists?$filter=substringof('Documents',Title) eq false