Forum Discussion
Adding Sharepoint Lookup Item With Graph
I'm experimenting with Graph (Beta) with Sharepoint. I can create items and update their fields. It works for simple fields like text andnumbers. Howerver, I can't figure out how to update fields like lookup and the one with multiple values.
If I read an item and look at a lookup field, it looks like this:
"Predecessors": [
{
"LookupId": 80,
"LookupValue": "Create general slides masters"
}
]
If I do the same format (but only the LookupId portion) with a PATCH request and the right url, it gives e malformed request.
Anyone knows how to form the request for these more complex types?
Etienne Fortin
14 Replies
- Gerco_WeststeijnCopper Contributor
Etienne Fortin Have you found a solution to this issue? I am experiencing the same problem.
- Sten_VervoortCopper Contributor
Etienne Fortin The key is to append "LookupId" to the column name. So if the lookup column name is "Predecessors", then insert the following JSON:
"PredecessorsLookupId": 80,
See https://sharepoint.stackexchange.com/questions/238346/how-to-do-microsoft-graph-api-filter-on-lookup-column-in-sharepoint-list-items
- Laurence Lemmon-WardeCopper Contributorthat is exactly what I was looking for thanks
- Anders LooftCopper Contributor
Did you find an answer yet? Having the same issue, only when creating an item instead of updating
- Etienne FortinCopper Contributor
No I didn't.
But you mention being able to update a lookup item? How do you proceed? How did you make it work. I can't update either.
- Anders LooftCopper ContributorI'm sorry if I was unclear, but no, I have not gotten update to work (nor tried to) either. I just get the same errors as you.
- Ketill Antoníus ÁgústssonCopper Contributor
I am now faced with the same task, did you figure out how to do it?
- Etienne FortinCopper Contributor
Unfortunetely not. Can't figure out how to do it.
- Ketill Antoníus ÁgústssonCopper Contributor
Too bad :(
But are you successfully calling the view-items endpoint:
/beta/sites/{site-id}/lists/{list-id}/items
and getting a non-null response?
Because all I get as a response is:
{ "@odata.context": "https://graph.microsoft.com/beta/...", "value": [] }