Forum Discussion

Brent Ellis's avatar
Brent Ellis
Silver Contributor
Sep 02, 2016

Need to update a multi-value person field via REST in SharePoint Designer

I am attempting to update an item in a signature from a root level SharePoint Designer workflow. Using dictionaries and the Call HTTP Web Service POST action.

I can update every type of column EXCEPT a multi-value person field.

Does anyone know how to correctly format the content in a dictionary for a multi value person field?

I'll update this post with exact error messages when I get to a computer.

 

Edits:

Update with a few details

  • If you query the mutli-value person field (as a string) in the source list, you get something that looks like this:
    • {"__metadata":{"type":"Collection(Edm.Int32)"},"results":[27,28,29]}
  • The typical error message I get when attempting update operations to the destination list
    • {"error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","value":"An unexpected 'StartObject' node was found when reading from the JSON reader. A 'StartArray' node was expected."}}}

 

My update is a POST call to: <site url>/_api/web/lists(guid'<list id>‍')/Items(<item id>)

 

Dictionary for Request Headers:

Accept = application/json;odata=verbose

Content-Type = application/json;odata=verbose

IF-MATCH = *

X-HTTP-METHOD = MERGE

 

Dictonary for Request Metadata:

Type = SP.Data.ItemWhatever

 

Dictionary for Update Content

__metadata = Dictionary for Request Metadata

multiplepersonfield1Id = whatever update variable I am testing here

 

I've tried setting multiplepersonfield1Id to various text values, integer values, dictionary values with no luck

  • O365Developer's avatar
    O365Developer
    Brass Contributor

    Brent Ellis ,@OferGal

     

    Hi ,

    Hope you are using PnPJS

    People picker is a lookup field for sharepoint ,so its stored as "ID;#Domain\username".

     

    Lets say your picker fieldname is "Contact" ,in your POST request when you send the data ,send the data as below

    {
    ContactId:1
    }

     

    1 is the USERID of the user,selected in people picker.

     

    That works for the Single User.

     

    For multiuser, you need to send as an array of Ids [1,2,3];

     

Resources