cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft
Microsoft

Unable to POST to People column using Send HTTP request to SharePoint

Any tips on how to format JSON to write to a People column?

 

I am copying columns from one list to another using Flow but am unable to copy a people column. 

I am able to use Create item to write to a people column using email claims but not via the REST API.

I have tried passing a claims array:

'PeopleColumn:'

[

{

    'Claims': 'i:0#.f|membership|email@company.com'

}

]   

But no results:

PeopleColumnId = null

PeopleColumnStringId = null

 

I have seen examples using SharePoint UserIds - use the GetbyEmail to resolve the Id but the people in the source list are not SharePoint users, ie: they have not browsed the site. They are valid accounts that SharePoint is able to resolve and Create items is able to convert but not REST.

 

I tried writing to the Hidden Id column:

'PeopleColumnId': {
'__metadata': {
'type': 'Collection(Edm.Int32)'
},
'results': [
11
]
},

 

Even tried using the Office 365 Users Action, no luck.

 

Am I missing something in the JSON body syntax? 

Is this scenario only possible via Create items? 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft
Microsoft

Thanks for the reply, Bof. 

In this case, the users have not browsed the SharePoint site so they won't be returned by the siteusers API call.

And we don't really want to add them to the siteusers list, we just want a valid id that SharePoint can resolve.

 

As they are in Active Directory we can POST to /ensureusers('email') which returns a user ID (if they are in AD)

Add that user ID to an array, post that array in the REST call and they will appear in the multiselect people column.

 

HTTP call to SharePoint to generate a user id for non-site users, email is username@domain.com 

Evervescent_1-1610752998884.png

Add the user ID to the array and Post the array. Make sure to add "Id" to the name of the people column 

Capture.JPG

This approach allows you to use dynamic variables for your site and list when copying multivalue people columns. 

View solution in original post

2 REPLIES 2
Community Support
Community Support

Hi @Evervescent :

Firstly,let me explain why you encountered this problem:

The key is that you need to update the personnel column via HTTP request using "Id".

Secondly,you could find all the site users and users id with this request:

/_api/web/siteusers

I've made a test for your refrence:

1\There is a person column named 'Person1'(do not allow multiple selelctions) in my SharePoint List 'Safety Issue'.

2\My Flow

I assume that I want to update the value of the person1 field of the first item to a user whose email address is "bof@xxx"

1.JPG2.JPG3.JPG

I think this link will help you a lot:

How to update “Person or Group” column in SharePoint List using REST API 

Best Regards,

Bof

Microsoft
Microsoft

Thanks for the reply, Bof. 

In this case, the users have not browsed the SharePoint site so they won't be returned by the siteusers API call.

And we don't really want to add them to the siteusers list, we just want a valid id that SharePoint can resolve.

 

As they are in Active Directory we can POST to /ensureusers('email') which returns a user ID (if they are in AD)

Add that user ID to an array, post that array in the REST call and they will appear in the multiselect people column.

 

HTTP call to SharePoint to generate a user id for non-site users, email is username@domain.com 

Evervescent_1-1610752998884.png

Add the user ID to the array and Post the array. Make sure to add "Id" to the name of the people column 

Capture.JPG

This approach allows you to use dynamic variables for your site and list when copying multivalue people columns. 

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (73,731)