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 / Add security group to ...
Power Automate
Suggested Answer

Add security group to Sharepoint folder via a flow

(1) ShareShare
ReportReport
Posted on by 1,164

Hi,

I have a Security Group created in the Office 365 Admin portal and would like to assign that to a folder in a document library for my Sharepoint Online.

The Grant Access to an Item or Folder doesn't work as when I type the security group name in the Recipients folder, it comes up but when I click on it nothing happens.

Im now working on implementing a HTTP request with the following 

_api/lists/getByTitle('DocumentLibrary')/items(@{triggerBody()?['entity']?['ID']})/roleassignments/addroleassignment(principalid=guid of security group,roleDefId=1111111111)

. I get the objectid for the security group from Azure.

Error I get is The expression is not valid

Thanks in advance for any assistance

Todd

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

    Hi @Tango,

     

    The value for the Principalid property/parameter is normally an integer/number. It looks like you have used a Guid?

     

    You can retrieve that id by querying the siteusers (and groups) via a HTTP request.

     

    Below is an example

     

    _api/web/SiteUsers/GetByLoginName('@{variables('LoginName')}')/Id

     

    53304875614_f006d2aef9_c.jpg

     

    I also have a blog about this approach:

    https://www.expiscornovus.com/2023/11/02/get-principal-id-by-loginname-for-entra-id-group/

     

  • Tango Profile Picture
    1,164 on at

    Thanks for your message @Expiscornovus but I am working off Security Groups.

     

    Would have thought it to be a common scenario where Enterprises use a Security Group.

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

    Hi @Tango,

     

    Yes, I was talking about Entra Id (fka Azure Active Directory) security groups in my example.

     

    So, you should be able to use this approach in SharePoint.

  • Suggested answer
    Inogic Profile Picture
    1,135 Super User 2025 Season 2 on at
    Hi Todd,

    It sounds like you're trying to assign a Security Group to a folder in your SharePoint Online document library, but are encountering issues with the process. The approach you're taking with an HTTP request is technically valid, but it seems to be hitting some roadblocks.

    Instead of implementing a solution in this core technical way, you can simply use Inogic's SharePoint Security Sync app. This tool will easily help you assign and synchronize security group permissions with your SharePoint Online document library, ensuring that the correct access controls are applied without the need for complex custom scripts.

    SharePoint Security Sync seamlessly integrates the security model and permissions of Dynamics 365 CRM with SharePoint. Also, when user security roles are updated in Dynamics 365 CRM, these changes are automatically reflected in SharePoint, ensuring consistent file-level access control. The synchronization supports various access levels, including Users, Business Units, Parent-Child Business Units, and Organizations, ensuring that only authorized individuals can view or modify files and real-time notes.

    This app streamlines the management of security settings, making sure your SharePoint environment accurately mirrors your CRM’s security configuration. Additionally, SharePoint Security Sync allows for the creation of a custom folder structure within SharePoint for storing documents and attachments, effectively addressing the 5000 file limit issue commonly faced in SharePoint.

    To experience the full capabilities of this tool, you can download SharePoint Security Sync from Inogic or Microsoft AppSource and take advantage of a 15-day free trial. For more details or assistance, feel free to contact us at crm@inogic.com.
     
    Thanks,
    Sam

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard