web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Creating a SP Group Us...
Power Automate
Unanswered

Creating a SP Group Using Power Automate and REST API

(0) ShareShare
ReportReport
Posted on by 1,360

Hello,
I found a resource that explains how to create a SharePoint group using Send an HTTP Request and Parse JSON.
However, when I use this, a new SP Group(s) is not created.
Any help would be appreciated.

golfnutt82_1-1630419151103.png

 

Categories:
I have the same question (1)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @golfnutt82,

     

    Can you switch the method from GET to POST? 

  • golfnutt82 Profile Picture
    1,360 on at

    I tried Post and it hung forever.

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @golfnutt82,

     

    Did you try it with the same title and description in the body of the request from your first screenshot?

     

    If so, can you try a different title (e.g. FlowGroup2)? It looks like the SharePoint group with title FlowGroup already exists (looking at the get GET response from your first screenshot).

  • golfnutt82 Profile Picture
    1,360 on at

    I tried changing it to "FlowGroup1" ran it but I still dont see a created group.

    golfnutt82_0-1630431814142.png

     

  • golfnutt82 Profile Picture
    1,360 on at

    I think I know what the issue but I am not sure so maybe you can clear things up for me.
    Where the URI is I entered per the instruction 

    golfnutt82_1-1630497641614.png

    Because I am working from withing a sub-site having unique permissions from the parent should the URL look different? I am concerned that I created the group(s) at the top level.

    golfnutt82_2-1630497819385.png

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @golfnutt82,

     

    You are looking at the assigned permissions. We haven't assigned any permission level (e.g. read, edit or full control) to this group yet. That is why it isn't shown in the site permissions overview.

     

    If you want to see the group itself you could navigate to the People and Groups overview of the sub-site. That should be accessible via this url:

    /sites/Test-IT/SecTest/SecTest1/_layouts/15/groups.aspx

  • golfnutt82 Profile Picture
    1,360 on at

    Ahh, I see. Yes the group was created but now I want to assign the group permissions and then add users.
    I appreciate your help.

  • golfnutt82 Profile Picture
    1,360 on at

    I just thought of something; what if the group is already created? Can I check this condition and then just add the user to the existing group?

  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @golfnutt82,

     

    1. To check if the SharePoint group already exists you can use a filter with the Title with a GET request. If the response is empty your group doesn't exist yet.

     

     

    _api/Web/SiteGroups/?$filter=Title eq '@{variables('SharePointGroupName')}'

     

     

    getsitegroups.png

     

    2. To add a user you can use a POST request against the specific site group.

    Make sure you use the correct claim of the user.

     

     

    _api/web/sitegroups/GetByName('@{variables('SharePointGroupName')}')/Users

     

     

     

    { 
     '__metadata': { 
     'type': 'SP.User' 
     }, 
     'LoginName': '@{variables('UserClaim')}' 
    }

     

     

    addusertogroup.png

     

    3. When the site already has unique permissions you can use the addroleassignment method with a POST request to assign permissions to your new or existing group.

    In the example below I am using contribute permission. Also make sure you use the correct principalid of the SharePoint group.

     

     

    _api/web/roleAssignments/addroleassignment(principalId=@{variables('Id')}, roledefId=1073741827)

     

     

    grantcontributepermissiontogroup.png

  • golfnutt82 Profile Picture
    1,360 on at

    Thank you very much for these details!
    Extremely grateful for your assistance.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard