2

The $filter method works perfectly on regular text columns, but I can't figure out how to use it with a "Hyperlink or Picture" type column. For example:

/_api/web/lists/getbytitle('Sponsors')/items?$filter=substringof('/sites/example.aspx',Target_URL)

This query is meant to get all the items in the Sponsors list where Target_URL contains the given string. Target_URL is a "Hyperlink or Picture" type column. But it doesn't work.

5

It is a limitation in SharePoint 2013 REST filter.

You need to use CAML query along with REST.

url: "/_api/web/lists/getbytitle('Sponsors')/getitems"
method: "POST",
body: "{ 'query' : {'__metadata': { 'type': 'SP.CamlQuery' }, "ViewXml": "<View><Query><Where><BeginsWith><FieldRef Name='URL'/><Value Type='URL'>url</Value></BeginsWith></Where></Query></View>" } }",
headers: {
    "accept": "application/json; odata=verbose",
    "content-type": "application/json; odata=verbose"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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