cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Responsive Resident
Responsive Resident

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

View solution in original post

6 REPLIES 6
Highlighted
Responsive Resident
Responsive Resident

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

Highlighted
Helper II
Helper II

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.

Highlighted
Responsive Resident
Responsive Resident

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

View solution in original post

Highlighted
Helper II
Helper II

Re: Patch SharePoint person or group

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

Highlighted
Helper II
Helper II

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!

 

Highlighted
Regular Visitor

Re: Patch SharePoint person or group

This also worked for me, I changed the code a little, but it worked like a charm!

 

Patch( 'FiveWhysSettings', First( Filter( 'FiveWhysSettings', Title = FixedPlant")),
{
ReliabilityEngineer: ComboBoxJobPerson.Selected.Value, 

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

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,675)