Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

OData substringof Examples

Posted by Paul on July 3, 2015


In this article we can explore OData examples for string method substring.

substringof

This filter returns the field values containing specified string.

Please note that the method-name is case sensitive & only lower case works.

Example

Please create the data as shown below.

image

Following is the query URL.

http://sharepoint/_api/Web/Lists/GetByTitle(‘Contacts’)/Items?$filter=substringof(‘avv’,Title)

Following is the result using Chrome browser.

image

image

Please note that we are querying against column named Title. The column name appears second after the value.

More Examples

You can now try a non-existing string.

Following is the URL:

http://sharepoint/_api/Web/Lists/GetByTitle(‘Contacts’)/Items?$filter=substringof(‘ABC’,%20Title)

The result is empty XML packet.

image

image

Please note that the operation name should be in lower-case.

References

https://msdn.microsoft.com/en-us/library/gg309461.aspx

Summary

In this article we have explored OData examples for string method substring.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s