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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SharePoint connector -...
Power Apps
Answered

SharePoint connector - 'Shared With' property

(0) ShareShare
ReportReport
Posted on by 446

Has anyone had any experience using the 

ThisItem.'Shared With'

property to display a list of users that have access to a SharePoint document library? In my app I have the ability to add and remove user permissions for document libraries using this. The add/remove works properly on the SharePoint end, but when I grab the collection again it still displays users that were previously added.

 

I let it sit for a day to see if it was some sort of sync issue, but they names are still appearing even though they don't have access to the document library or the site itself. Anyone have any clue as to why this is the case?

 

If anyone knows of an alternative or better way to do this that doesn't involve creating a SharePoint list, that would be welcomed as well.

 

Thank you!

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    Can you explain a bit more how you are retrieving the 'Shared With' property of the library?  It was my understanding that this was a dynamic view in the SharePoint web and not an actual property that could be retrieved.

  • Ryan_B Profile Picture
    446 on at

    @Pstork1 

     

    So the process is I grab a collection called DocumentsFolders that includes all the document libraries within the "Documents" (or "Shared Documents" depending on how you look at it) section of the respective SharePoint data source.

    ClearCollect(DocumentsFolders, ThisItem.DataSource);

     

    I then use this collection in a gallery to display these folders to the user, who can then select an edit icon to manage the user permissions for that folder.

     

    This edit icon performs the following command: 

    ClearCollect(EditFolderPermissions, ThisItem.'Shared With');

     

    Once they select this and move to the Edit Folder Permissions screen, I'm using the above collection to display who has access to the selected folder. They can then add or remove permissions based on what they see in the gallery. The add and removal process works on the SharePoint side, but on Power Apps the collection still shows users who used to have access but no longer do. I even refreshed the data source and the collection, but they reappear no matter what I do.

  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    To clarify.  The SharePoint connector will be set to a specific document library, so the Document Folders collection will include folders, not libraries.  Unless I'm missing something. So we are dealing with folder permissions not library permissions.  

     

    But here's what I think might be happening.  At the folder level there are permissions and sharing links.  When you share a folder it doesn't break inheritance and change the permissions on the folder it just creates a sharing link.  Compare the upper and lower half of this screenshot for what I mean.

    image.png

    So when you edit permissions what exactly are you changing?  The actual permissions or a sharing link?  I suspect the Shared With is only showing one of these and you are changing the other.

  • Ryan_B Profile Picture
    446 on at

    @Pstork1 

     

    Sorry for the confusion. Your clarification is correct - it's grabbing the folders found within the "Documents" document library, so we are dealing with folder permissions.

     

    That was a good point and suspicion, but unfortunately there aren't any sharing links. Here are parts of the flows that makes the changes to the SharePoint folder permissions for adding or removing users:

     

    Adding user permissions

    Ryan_B_1-1636559688334.png

    Ryan_B_0-1636559662170.png

     

    Removing user permissions

    Ryan_B_2-1636559751068.png

    Ryan_B_3-1636559768715.png

     

    Once these flows run, if I check the actual folder's permissions all the changes are made appropriately. Even in the advanced permissions area the users are no longer listed there. I've also made sure they aren't being hidden by the whole "Users with limited access" thing.

  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    I did a sample and I'm seeing the same thing you are.  But looking at your flow to set permissions.  You are indeed using sharing links if you grant permission using the built-in action.  The REST call you use for Deleting the permissions is the only way to actually break inheritance and set unique permissions.  The Grant view access is using the Sharing sub system.  Its that Sharing subsystem that shows up in the Shared With property, not the actual permissions.  But I haven't been able to figure out either how to get it to update.  I suspect the sharing entry isn't actually deleted when you remove them from sharing.  It just turns off the link, but its still there in the shared with.  At least that would be my theory.  I need to to do some more investigation.

  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    I think I found out what is happening.  The Shared With doesn't discriminate on what level of permissions.  Even after removing the user from permissions on the folder they will still have limited access permission.  That's why removing the user doesn't change anything.  Evidently the display in SharePoint filters out limited access, but Shared With in Power Apps doesn't.  Technically its still shared with them.  They just don't have enough access to do anything.  And since limited access is managed by the system there is no way to fix it.

  • Ryan_B Profile Picture
    446 on at

    @Pstork1 

    Ryan_B_0-1636560817950.png

    Here's what I'm seeing when I use my app to add user permissions to a folder. So if I'm understanding you correctly, shouldn't there also be something displayed in the "Links giving access" section? Or are you saying that it won't be displayed here because it's some sort of hidden backend thing?

     

    You might be on to something about the sharing link though, because I haven't seen any users that are part of groups displayed in my app.

  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    Click into the advanced view and then click on the show users link in the note at the top.  see if you don't see a custom SharePoint group with a guid in the title that has limited access.  This is how sharing links are done.

    image.png

    Also, in the screenshot you can see E2 Test User.  He was given direct permissions to the list itself and doesn't show in the Shared With list in SharePoint or in the app.  User's add through a sharing link do show in the list.  The action you are using in the flow definitely works through a sharing link, not by directly changing permissions.

  • Ryan_B Profile Picture
    446 on at

    @Pstork1 

     

    Ryan_B_0-1636561912109.png

    This is what I'm seeing in the advanced view. You are correct though in that the Test UserTwo doesn't appear in the list within my Power App.

  • Pstork1 Profile Picture
    69,330 Most Valuable Professional on at

    Run a Check User Permissions on the user that is still showing in the Shared With after being removed.  I suspect you will find that they still have limited access from somewhere.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard