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

Adding user to sharepoint security group

We are trying to use Microsoft Power automate to add a user to a sharepoint group. 

We keep hitting a internal server error. 

MRdeJongNN_0-1601205300459.png

 

We tried the created by claims, created by email and even hardcoding a specific email but it only gives an internal server error. 

 

Can anyone helps us identify what we are doing wrong?

 

KR, Manfred

1 ACCEPTED SOLUTION

Accepted Solutions
sudharsan1985
Super User
Super User

Hi @MRdeJongNN 

Just tried the same scenario, when I gave the group name, it didn't work so I tried with the group id and it worked. Can you please try the same by changing the API URL like the below

/_api/web/sitegroups/GetById(<groupid>)/users

Also, the body values should be without any unwanted space

{ 
'__metadata': { 'type': 'SP.User' },
'LoginName':'i:0#.f|membership|<UPN>'
}

Please try it out and let us know if you have any issues.

 

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

7 REPLIES 7
sudharsan1985
Super User
Super User

Hi @MRdeJongNN 

Just tried the same scenario, when I gave the group name, it didn't work so I tried with the group id and it worked. Can you please try the same by changing the API URL like the below

/_api/web/sitegroups/GetById(<groupid>)/users

Also, the body values should be without any unwanted space

{ 
'__metadata': { 'type': 'SP.User' },
'LoginName':'i:0#.f|membership|<UPN>'
}

Please try it out and let us know if you have any issues.

 

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

View solution in original post

Dear @sudharsan1985 , 

 

Thank you for your time. We implemented your suggested changes. Unfortunately we still get the same error message(internal server error). Any other options we could try?

 

KR, Manfred

 

MRdeJongNN_0-1601211577072.pngMRdeJongNN_1-1601211636667.png

 

Hi @MRdeJongNN 

There is something fishy on the group id, are you sure the group id is 1972? Can you verify the same by navigating to the group and confirm the query string value for MembershipGroupId.

 

 

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

Dear @sudharsan1985 , 

 

Thank you for your continues effort. I looked up if I might be mistaken on the sharepoint permission groupID. But this URL tells me that the format is correct. http://www.benprins.net/2019/09/02/sharepoint-get-all-the-ids/ (last part of the blog). 

 

Hereby my screenshot. 

 

Screenshot 2020-09-28 092823.png

Hi, can you make a quick test of just getting the group info using the REST API? We will see whether it's returning the group details or not.
Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...

HI @sudharsan1985 ,

 

I had to google how to do it, but was very simple indeed. Hereby the result. 

 

MRdeJongNN_0-1601279842817.png

 

Hi @sudharsan1985 ,

 

i retyped all the code and really made sure not to have any spaces in it and also get the capitalization right and now it works!! Thank you for you effort!

 

KR, Manfred

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,993)