Skip to main content

Notifications

Community site session details

Community site session details

Session Id : emT+AUyEz2vPZx4qii3oUn
Power Apps - Connector Development
Unanswered

Only list SharePoint items where user has edit rights in Power Apps

Like (0) ShareShare
ReportReport
Posted on 22 Jan 2025 09:32:11 by
I want to implement vertical gallery for my SharePoint document library. I want to display documents only where logged in user has edit rights. How can I apply this filter to check if user has access to that docs or not and only list those items on Power Apps. I am using SharePoint connector.
Categories:
  • vipuljain03 Profile Picture
    477 on 02 Feb 2025 at 19:08:54
    Only list SharePoint items where user has edit rights in Power Apps
    You can use a Power Automate Flow to Get User Permissions - this flow will retrieve the user's permissions for each document and returns a list of documents the user can edit. Your Power Apps gallery will then use the output of this flow.
     
    High-level steps which you can use in a flow:
     
    • Trigger: "Power Apps" trigger. This will receive the user's email address from Power Apps.

    • Get user profile (SharePoint): Use this action to retrieve details about the user.

    • Get files (properties only) (SharePoint): Use this action to retrieve only the metadata (including item ID) of the files in your document library. Don't retrieve the file content yet. This is important for performance.

    • Loop (Apply to each): Loop through the files retrieved in the previous step.

    • Get item permissions (SharePoint): Inside the loop, use this action, providing the file's item ID. This will return the permissions for the specific file.

    • Condition: Check if the current user has "Edit" permissions in the returned permissions object. The structure of the returned permissions object might vary slightly, but it will usually contain a property or role definition stating the permissions for the user. The condition might look similar to:
      contains(items('Apply_to_each')?['d']?['Roles']?['results'], 'Editor')  // or similar, adjust as needed
       
      {
        "d": {
          "Roles": {
            "results": [
              "Reader",
              "Editor" // The user has Editor access
            ]
          }
        }
      }


    • Append to Array Variable: If the condition is true (user has edit permissions), append the file's metadata (e.g., file name, URL, etc.) to an array variable.

    • Response (Power Apps): After the loop, send the array variable back to Power Apps.
    You can send the response of this flow back to Power Apps.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Connector Development

#1
CG-07052056-0 Profile Picture

CG-07052056-0 20

#2
stampcoin Profile Picture

stampcoin 6

#3
CU17051452-1 Profile Picture

CU17051452-1 2

Overall leaderboard

Featured topics

Loading started