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
Solution Sage
Solution Sage

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
Solution Sage
Solution Sage

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...

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (1,313)