2

my query https://graph.microsoft.com/beta/sites/mytenant.sharepoint.com:/sites/mysite:/lists/OEC_Docs?select=id,name,lastModifiedDateTime&expand=items(expand=fields(select=Title,Attachments,OptyNumber))&filter=items/OptyNumber eq '123'

fails with

{
  "error": {
    "code": "BadRequest",
    "message": "Invalid filter clause",
    "innerError": {
      "request-id": "f6426b70-ebe0-44ca-9439-34e1c94f19b0",
      "date": "2018-11-14T00:23:30"
    }
  }
}

where as without filter clause it works fine. based on docs it should work fine. please advise

1 Answer 1

4

You can try filtering list items by using similar query as given below:

For List on root site:

https://graph.microsoft.com/beta/sites/mytenant.sharepoint.com/lists/MyListName/items?expand=fields(select=ID,OptyNumber)&filter=fields/OptyNumber eq '123'

For List on subsite:

https://graph.microsoft.com/beta/sites/mytenant.sharepoint.com:/mysite:/lists/MyListName/items?expand=fields(select=ID,OptyNumber)&filter=fields/OptyNumber eq '123'

Note : In case it gives an error to index the field on which you are filtering the list items, try adding an index to that field.

Source: Add an index to a SharePoint column.

7
  • for me it still ends up with invalid filter clause. also notice that your list is not in the context of a site. this also seems to affect the query. as i need list of a site so even if above works my issue wont solve Commented Nov 14, 2018 at 7:09
  • my list is on root site Commented Nov 14, 2018 at 7:11
  • yes i know. but in my case query changes quite a lot after creating it under another site Commented Nov 14, 2018 at 7:29
  • Using similar to this https://graph.microsoft.com/beta/sites/mytenant.sharepoint.com:/sites/mysite:/lists, I am not able to get my subsite Commented Nov 14, 2018 at 7:39
  • Found it...see updated answer to query list from subsite. Commented Nov 14, 2018 at 7:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.