For example, say we have list Email and it contains field Recipient which is a user field. When you query this list using Sharepoint 2013 REST API you will get RecipientId field instead. This is the clue to updating the field - you just need to provide ID of the user you want to be a recipient.
var el = { "__metadata": { "type": "SP.Data.EmailListItem" }, Title: "Title of the message", Body" "Body of the message", RecipientId: 5 };
When your Recipients field has type of UserMulti you need to deal with the array of user IDs. You will need to specify also metadata for the array type: Collection(Edm.Int32).
var el = { "__metadata": { "type": "SP.Data.EmailListItem" }, Title: "Title of the message", Body" "Body of the message", RecipientsId: { "__metadata": { "type": "Collection(Edm.Int32)" }, "results": [5,4,6] }, };
No comments:
Post a Comment