user5850611
user5850611

Reputation:

MS Graph API use of LookupId from a list to another l

projectNameLookupId: "1"

projectName_x003a_projectCodeLookupId: "1"

responsibleLookupId: "14"

here are the fields in my 1st sharepoint list and I would like to fetch data from my 2nd sharepoint list using MS Graph with the help of this lookup id, so far here's the request url I've made

/sites/${SITE_ID}/lists/${LIST_ID}/items?$expand=fields&$select=id,fields&$filter=startswith(fields/projectName,1)

after that I'm receiving an error of invalid filter clause

Upvotes: 0

Views: 626

Answers (1)

Vadim Gremyachev
Vadim Gremyachev

Reputation: 59318

As OData Version 4.0 specification states, startswith function has the following signature:

Edm.Boolean startswith(Edm.String,Edm.String)

meaning the expression:

$filter=startswith(fields/projectName,1)
                                     ^^^^
                                     expects a string value

is invalid (and that's the reason why MS Graph complains with invalid filter clause error).

Here is a valid query:

https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}$expand=fields&$filter=startswith(fields/ProjectNameLookupId,'1')

Upvotes: 2

Related Questions