0

So I was following the instructions listed in these sites to build a proper query:

  1. https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests
  2. https://msdn.microsoft.com/en-us/magazine/dn198245.aspx

However, when I ran the following query, I got the infamous error object object error. In the below, PlNo and DgNo exists in SOMETHING table, so that is not the issue.
siteurl + "/_api/web/lists/getbytitle('SOMETHING')/items?$top=5000&$filter=(PlNo eq 1000) or (PlNo eq 1002)&$orderby=DgNo asc"

I tried this as well, and it works:
siteurl + "/_api/web/lists/getbytitle('SOMETHING')/items?$top=5000"

So I thought, maybe it is the & that is wrong, so I went forward and did the below:
siteurl + "/_api/web/lists/getbytitle('SOMETHING')/items?$filter=(PlNo eq 1000)

And that works, so I guess, why does the & produce the error as shown?

EDIT: The question has been edited for easier reading. For info, the screenshots of the error is shown below: Error object Object

  • 1
    As you said siteurl + "/_api/web/lists/getbytitle('SOMETHING')/items?$top=5000 URL works .....But is siteurl + "/_api/web/lists/getbytitle('SOMETHING')/items?$filter=(PlNo eq 1000) URL works ?? – Rohit Waghela Dec 1 '17 at 8:26
  • and can you post screenshot of your error message – Rohit Waghela Dec 1 '17 at 8:28
0

If you want to apply multiple filter condition in Rest API, please use the filter like the format below:

https://tenant.sharepoint.com/sites/sitname/_api/web/lists/GetByTitle('listname')/items?$select=ID,Title&$filter=((Title eq 'test') or (Title eq 'testtitle'))

This is the filter result for the Title field equals 'test' or 'testtitle':

enter image description here

Reference:

SharePoint 2013 REST services: How to apply multiple filters on Get List Item Query

| improve this answer | |
  • Erm, can you point out what I might have missed? The statement you constructed appears to be of the same syntax...? Why did yours work and the one I have did not? Is SELECT necessary? I thought if you don't use SELECT, it should return most of all columns except for the resource intensive ones? – Isa Dec 28 '17 at 10:12
  • Please read my example Rest Endpoint carefully, you need to put the multiple condition filter in () like &$filter=((Title eq 'test') or (Title eq 'testtitle')) !!!!! – Jerry_MSFT Dec 28 '17 at 10:44
  • Determined brackets is not the problem... Not accepted. – Isa Jan 1 '18 at 22:45
0

The issue lies in "orderby". Apparently, Sharepoint 2013 online is camel script only. You should use "orderBy" and it will work just fine.

Best wishes!

For those who stumble across this and need some resources for testing, try this script attached as a fiddle - it will not work in js-fiddle since the script will only work on the site you are testing the queries by checking where the page is resided. You can simply copy and paste the HTML portion into a js file, do your jquery includes, and copy and paste js portion in the fiddle within a <script></script> tag and feed the file through the content editor webpart.

https://jsfiddle.net/silveryne/8o5axvLp/1/

| improve this answer | |

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.