Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
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
    464 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

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

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,081 Most Valuable Professional

Leaderboard

Featured topics

Loading started