SharePoint Rest OData query

Only basic OData query operators supported in the SharePoint Rest service

https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#bk_supported

String Comparisions (startWith, substringof, Eq, Ne)

 

Full OData Query option from odata.org

http://www.odata.org/documentation/odata-version-2-0/uri-conventions/#FilterSystemQueryOption

 

SharePoint REST API Supporting keywords – OData query URL

SharePoint REST API Supporting keywords – OData query URL

http://www.andrewconnell.com/blog/Applying-Filters-to-Lookup-Fields-with-the-SP2013-REST-API

 

-When you filter user object field you can filter without id postfix.

when you select the user field(Created by)

you can use $select=AuthorId

but you can’t use $filter=AuthorId eq 10

instead of you can use $filter=Author eq 10 without Id postfix.

or you can use $expand option

However there is no way to check user field is null or empty with OData query

Query for multi-value lookup fields and users

: Because multi-value lookup fields are returned as a string of multiple values, there is no way to query for them (for example, the equivalent of an Includes element or NotIncludes element is not supported).

So we have to use Rest Caml query

https://<site>/_api/web/Lists/GetByTitle(‘%5Blist name]’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query>[other CAML query elements]</Query></View>”}

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: