Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'd like to filter a rest request and get the opposite of:

filter=substringof('foo', Title)

I've tried with a leading "not" and also ending with "eq false" but those it seems are not valid queries. I guess what I'm really lacking is a complete documentation of the filter regular expression syntax.

share|improve this question

2 Answers 2

The figure below shows the supported OData query options and how to specify supported filters enter image description here

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
share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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