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 startswith Examples

Posted by Paul on June 30, 2015


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

startswith

This filter returns the field values starting with 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=startswith(Title,’Bran’)

Following is the result using Chrome browser.

image

image

Please note that we are querying against column named Title.

Another Example

Now let us try with an non-existing string.

Following is the query URL.

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

Following is the result using Chrome browser which shows no-results.

image

You can now play with more examples.

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 with method startswith.

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