cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
golfnutt82
Helper IV
Helper IV

Adding Users to a SharePoint Security Group

Hello, 
I am attempting to add a user to a security group but I am receiving an error that states:

golfnutt82_0-1633983828840.png

golfnutt82_1-1633983862738.png

 

Any help would be appreciated

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @golfnutt82 

 

This worked for me

DamoBird365_0-1634066497100.png

Header:

{
"accept": "application/json;odata.metadata=none",
"content-type": "application/json"
}

 

Body:

{'LoginName':'i:0#.f|membership|damien@abdndamodev.onmicrosoft.com'}

note the single quotes on the body - don't ask!?

 

Here is the success...

DamoBird365_1-1634066606740.png

 

 

Please consider accepting my answer as a solution if it helps to solve your problem.

Cheers
Damien

Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

View solution in original post

9 REPLIES 9
golfnutt82
Helper IV
Helper IV

I saw that I was missing the single quotes around the folder name just before /Users but now getting this error.

golfnutt82_0-1633984360204.png

 

DamoBird365
Super User
Super User

Hi @golfnutt82 

 

Just written an article on this https://www.damobird365.com/add-members-to-a-distribution-list/, it's a lot easier to use the add members to group action.  All you need is the security group GUID, the same process applies for Distribution lists too.

 

Please consider accepting my answer as a solution if it helps to solve your problem.

Cheers
Damien

Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

Hi @golfnutt82 

 

Forgive me - you are referring to SharePoint Security groups... 😂  I need to hit the sack

 

Give me a moment to look into it for you.

 

Damien

DamoBird365
Super User
Super User

Hi @golfnutt82 

 

I think you are missing single quotes around the security group name.

 

https://contoso.sharepoint.com/sites/DamoBird365/_api/web/siteGroups/getByName('DamoBird365%20Owners...

 

Damien

Hi and thanks for your reply.
Everything that I am doing is automated.
I am creating the security permission groups based on input from the user.
If the user inputs from a drop down "Secure Folder" then new library is created, site permissions are broken or disenherited and a new security group is created that is based on a the user role; in this case a contibute group is created for the library. After the role creation approval happens people can then request access to the role/security group and if approved they are added to that security group and this is where I am finding difficulty.
I feel I am close.
Everything is automated and being driven by HTTP requests and api REST 

Hi, 
Yes, I found those to but it didnt help.
Still digging.

golfnutt82
Helper IV
Helper IV

I changed the URI syntax to look as follows:

golfnutt82_1-1634040092012.png

Getting this error now

golfnutt82_0-1634040030918.png

 

Hi @golfnutt82 

 

This worked for me

DamoBird365_0-1634066497100.png

Header:

{
"accept": "application/json;odata.metadata=none",
"content-type": "application/json"
}

 

Body:

{'LoginName':'i:0#.f|membership|damien@abdndamodev.onmicrosoft.com'}

note the single quotes on the body - don't ask!?

 

Here is the success...

DamoBird365_1-1634066606740.png

 

 

Please consider accepting my answer as a solution if it helps to solve your problem.

Cheers
Damien

Please take a look and subscribe to my YouTube Channel for more Power Platform ideas and concepts, or take a look at my website. Thanks

View solution in original post

I had a typo I believe, uhg.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,900)