cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
taramoe
Level: Powered On

Patch SharePoint person or group

I have a gallery where I need to update an individual SharePoint record in a list called 'Meeting Schedule'.  I can't quite seem to get the syntax or code correct to update the Person/Group field in the SharePoint list.  I'm basically clearing out a whole group of fields and setting them to blank.  The field 'SSM' is the People/Group field. 

 

Patch('Meeting Schedule',ThisItem,

{Title:"", Location: "",
SSM:

{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Claims: "",
Department: "",
DisplayName: "",
Email: "",
JobTitle: "",
Picture: ""}
})

1 ACCEPTED SOLUTION

Accepted Solutions
HadynM
Level 8

Re: Patch SharePoint person or group

Aaaaahhhh my mistake, sorry.

Using MS Flow is the only way I've been able to get it to work.

This article gives a good indication of how to do it:

https://poszytek.eu/en/microsoft-en/office-365-en/powerapps-en/clear-lookup-and-people-picker-fields...

If you haven't used the sharepoint http request action before the following line gave me the most trouble:

"__metadata":{"type":"SP.Data.MyListNameListItem"}

It is a double underline at the start and the name of your list in bold.

I would be interested if you figure out how to do it directly from PowerApps.

Cheers

Hadyn

5 REPLIES 5
HadynM
Level 8

Re: Patch SharePoint person or group

Hi @taramoe

A great response from @v-micsh-msft on this post:

https://powerusers.microsoft.com/t5/General-Discussion/Saving-data-from-powerapps-to-SP-lists-person...

 

I create a variable for each claim (person) that I want to include in a patch:

Set(requesterClaim,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & User().Email,
    Department:"",
   DisplayName:User().FullName,
         Email:User().Email,
      JobTitle:"",
       Picture:""
   });
Set(newBooking, 
    Patch(CafeteriaBookings,Defaults(CafeteriaBookings), {
        Title: "Booking",
        Requester: requesterClaim,
        Reason: tiReason.Text,
        docHTML: htmlDoc,
        PreviousState: ""
    })
)

The Claims, DisplayName, and Email are the required fields.

Hope that helps

Hadyn

taramoe
Level: Powered On

Re: Patch SharePoint person or group

Thanks @HadynM

 

I'm trying to null out the person/group field and I don't think the below solution addresses that?  Please correct me if I'm wrong.  My goal is to clear out the field and this is where I'm stuck.  Thanks for any help you can provide.

HadynM
Level 8

Re: Patch SharePoint person or group

Aaaaahhhh my mistake, sorry.

Using MS Flow is the only way I've been able to get it to work.

This article gives a good indication of how to do it:

https://poszytek.eu/en/microsoft-en/office-365-en/powerapps-en/clear-lookup-and-people-picker-fields...

If you haven't used the sharepoint http request action before the following line gave me the most trouble:

"__metadata":{"type":"SP.Data.MyListNameListItem"}

It is a double underline at the start and the name of your list in bold.

I would be interested if you figure out how to do it directly from PowerApps.

Cheers

Hadyn

taramoe
Level: Powered On

Re: Patch SharePoint person or group

Thanks @HadynM, I'll give it a try.  Appreciate the help.

taramoe
Level: Powered On

Re: Patch SharePoint person or group

Hi @HadynM - Just wanted to say thank you for your help here.  I had abandoned working on this for awhile and came back to it recently and your tips were enormously helpful and it's working beautifully in Flow.  I plan to call the flow from PowerApps or use some other Flow trigger (haven't figured this part out yet but shouldn't be too complicated).

Thanks again!

 

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 198 members 4,384 guests
Please welcome our newest community members: