cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
fher
Frequent Visitor

Adding UserGroup to Sharepoint

Hi all,

 

I encountered a problem and am curious if someone of you already did something similar.

 

I have a Datasource which is a SP List. This List have a Column for "Person/Groups". I am building a Powerapp which should add values to this column. When it comes to Persons its working just fine with the following code:

 

AddUserToSP.PNG

Now i want to add a Group to the SP List but i cannot get it working.

 

I would be glad if someone of you got an idea or even a solution for it.

 

Thank you in advance

Felix

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @fher ,

Could you please share a bit more about your scenario?

Do you enable the "Allow selection of Groups" option for the "Person" field in your SP list?

Further, could you please share a bit more about the ComboBox1 mentioned in your formula?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

1. If you do not enable the "Allow selection of Groups" option for the "Person" field in your SP list:

Please modify your Patch formula as below (Patch Person/User data back to the "Verwalter" field in your SP list😞

 

Patch(
          KontingentverwaltungUser;
          Defaults(KontingentverwaltungUser);
          {
             Title: ComboBox1_1.Selected.DisplayName;
             Verwalter: {
Claims: "i:0#.f|membership|" & Lower(ComboBox1.Selected.email); /* <-- Please type ComboBox1.Selected.email rather than ComboBox1.Selected.displayName */ DisplayName: ComboBox1_1.Selected.DisplayName;
Email: ComboBox1.Selected.email; Department: ""; JobTitle: ""; Picture: "" } } )

 

 

2. If you enable the "Allow selection of Groups" option for the "Person" field in your SP list (patch a Group value back to the "Verwalter" field in your SP list😞

Firstly, you need to find the Claims property for groups in your Org. On your side, please add the following formula within the OnSelect property of a button:

ClearCollect(Colelction1, Choices(KontingentverwaltungUser.Verwalter))

then go to review the Collection1, the Claim property for groups would looks like as below:1.JPG

after that, you should retrieve the group id based on the selected group name using the following formula:

 

LookUp(Office365Groups.ListOwnedGroupsV2().value, displayName = ComboBox1.Selected.displayName).id

then you need to modify above Patch formula as below:

 

Patch(
          KontingentverwaltungUser;
          Defaults(KontingentverwaltungUser);
          {
             Title: ComboBox1_1.Selected.DisplayName;
             Verwalter: {
Claims: "c:0o.c|federateddirectoryclaimprovider|" & LookUp(Office365Groups.ListOwnedGroupsV2().value, displayName = ComboBox1.Selected.displayName).id; /* <-- Please type ComboBox1.Selected.email rather than ComboBox1.Selected.displayName */ DisplayName: ComboBox1_1.Selected.DisplayName;
Email: ComboBox1.Selected.email; Department: ""; JobTitle: ""; Picture: "" } } )

The 'c:0o.c|federateddirectoryclaimprovider|' value in above formula should be replaced with the corresponding value on your side.

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @fher ,

Could you please share a bit more about your scenario?

Do you enable the "Allow selection of Groups" option for the "Person" field in your SP list?

Further, could you please share a bit more about the ComboBox1 mentioned in your formula?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

1. If you do not enable the "Allow selection of Groups" option for the "Person" field in your SP list:

Please modify your Patch formula as below (Patch Person/User data back to the "Verwalter" field in your SP list😞

 

Patch(
          KontingentverwaltungUser;
          Defaults(KontingentverwaltungUser);
          {
             Title: ComboBox1_1.Selected.DisplayName;
             Verwalter: {
Claims: "i:0#.f|membership|" & Lower(ComboBox1.Selected.email); /* <-- Please type ComboBox1.Selected.email rather than ComboBox1.Selected.displayName */ DisplayName: ComboBox1_1.Selected.DisplayName;
Email: ComboBox1.Selected.email; Department: ""; JobTitle: ""; Picture: "" } } )

 

 

2. If you enable the "Allow selection of Groups" option for the "Person" field in your SP list (patch a Group value back to the "Verwalter" field in your SP list😞

Firstly, you need to find the Claims property for groups in your Org. On your side, please add the following formula within the OnSelect property of a button:

ClearCollect(Colelction1, Choices(KontingentverwaltungUser.Verwalter))

then go to review the Collection1, the Claim property for groups would looks like as below:1.JPG

after that, you should retrieve the group id based on the selected group name using the following formula:

 

LookUp(Office365Groups.ListOwnedGroupsV2().value, displayName = ComboBox1.Selected.displayName).id

then you need to modify above Patch formula as below:

 

Patch(
          KontingentverwaltungUser;
          Defaults(KontingentverwaltungUser);
          {
             Title: ComboBox1_1.Selected.DisplayName;
             Verwalter: {
Claims: "c:0o.c|federateddirectoryclaimprovider|" & LookUp(Office365Groups.ListOwnedGroupsV2().value, displayName = ComboBox1.Selected.displayName).id; /* <-- Please type ComboBox1.Selected.email rather than ComboBox1.Selected.displayName */ DisplayName: ComboBox1_1.Selected.DisplayName;
Email: ComboBox1.Selected.email; Department: ""; JobTitle: ""; Picture: "" } } )

The 'c:0o.c|federateddirectoryclaimprovider|' value in above formula should be replaced with the corresponding value on your side.

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xida-msft ,

 

thank you so much. This is just the solution I was looking for.

 

First of all, i did not check the "Allow selection of Groups" in the first place. Thats kind of confusing because the type of the column "Person/Groups" is implying that you can add groups with no further configuration. But Ok.

 

The other problem was of course, that i had no idea what value "Claims" should have.

 

Again. Thank you very much.

 

Another task of the app should be (on a different screen) to check if a specific User is in a group. For Example a User named "John" is in the group "Swimmers". How do i check if "John" is in this group on a button click?

 

Cheers,

Felix

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,713)