OData not operator, or how to filter for all items which not startswith(...) -
i using sharepoint rest api, similar odata, don't know standard odata way. filter items not start string pattern. how 'not' operator written in odata? references list 'and' , 'or' operators , 'ne' operators, cannot find 1 'not'.
neither of next work:
a)
not startswith(field, 'pattern') b)
startswith(field, 'pattern') ne true // yes know there no 'true' boolean literal.
even though diagram use odata query operations in sharepoint rest requests illustrates proper syntax startswith operator is:
filter=startswith(propertyname, 'string') eq boolean it seems syntax accepts is:
filter=startswith(propertyname, 'string') for example, request:
/_vti_bin/listdata.svc/pages?$filter=startswith(title,'sharepoint') eq false returns pages title not start sharepoint
but same request using _api service endpoint
/_api/web/lists/getbytitle('pages')/items?$filter=startswith(title,'sharepoint') eq false returns the query not valid exception.
solution
utilize listdata.svc endpoint since fully supports syntax of startswith operator specified in odata specification.
odata
No comments:
Post a Comment