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 Apps / Display button if user...
Power Apps
Answered

Display button if user is part of the SharePoint owners security group

(1) ShareShare
ReportReport
Posted on by 405

Hi,

 

Is there a way to show/hide a button if the current user belongs to the SharePoint Owners security group? 

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    poweractivate Profile Picture
    11,078 Most Valuable Professional on at

    @_sourcecod3_ 

    Yes, you can try to conditionally show/hide a button based on the current user's group membership in SharePoint.

     

    However, Power Apps itself doesn't really have a direct formula to fetch SharePoint group membership of the current user to my awareness.

     

    You would need to instead, create a flow in Power Automate that gets the SharePoint group membership and then call this flow from Power Apps.

     

    Here's how you could do this:

     

    1. Create a flow in Power Automate:

       a. The trigger should be PowerApps (V2)

       b. Add a Send an HTTP request to SharePoint action. Site Address is your SharePoint site URL. Method should be GET. Uri is _api/web/currentuser/groups.

       c. Parse the JSON result to get the group titles. Add a Parse JSON action. Content is body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']. Schema can be generated from a sample payload, which you can get by running the HTTP request in a browser.

       d. Initialize an array variable. Loop over the parsed results using Apply to each, and add the group titles to the array using Append to array variable.

       e. Finally, add a Respond to a PowerApp or flow action and provide the array variable as input.

     

    2. In Power Apps, call the flow and get the result:

       a. On App start, use ClearCollect(colUserGroups, YourFlowName.Run()) to run the flow and store the returned groups in a collection.

       b. Use the in operator to check if 'Owners' is in the returned groups. The Visible property of the button would be: 'Owners' in colUserGroups.

     

    Please note that the flow runs with the permissions of the current user, so it can only see the groups that the user has permissions to see.

     

  • _sourcecod3_ Profile Picture
    405 on at

    hi @poweractivate   This worked perfectly. Thank you so much. 

  • gelno Profile Picture
    3 on at

    Hi!

    I had the exact same need as the original poster. I followed your instructions and think I got everything correct. I get to your very last step (2 b as you have them written out) and cannot seem to get the Visible property to be happy with:

    'Owners' in colUserGroups

     

    Two questions.

    1) Wouldn’t it be Owner, not Owners as the SharePoint site permissions labels someone as Owner?

     

    2) Can you share the exact syntax or screenshot of how this should be written in the Visible property? I have tried many variations, some including an If statement. Currently I have:

    ’Owner’ in colUserGroup

    and I get an error that says:

    ‘Owner’ isn’t recognized


    If I understand the in operator correctly, it produces true/false without the need of an If statement.

     

    Thanks in advance for any help or direction you can give!

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard