I'm looking for a way how to update a lookup field and a user field with Microsoft graph ? I can read the item, but I don't find a way to create or update this kind of field even if I put a correct ID value.
4
votes
1 Answers
3
votes
Nowadays it is supported to update lookup fields via Microsoft Graph API.
Lets say there is a field named Category
, then depending whether lookup field is represented as single or multi valued, the following examples demonstrate how to set lookup field value.
for single-valued field:
Url: https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields
Method: PATCH
Body: {
"CategoryLookupId": "1"
}
where
field name
is provided in the following format:{field-name}LookupId
field value
corresponds to lookup id and provided as a string
for multi-valued field
Url: https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}/fields
Method: PATCH
{
"[email protected]": "Collection(Edm.String)",
"CategoryLookupId":["1","2"]
}