Hi everyone - looking for Power Apps Portal advice on displaying SharePoint files to Portal User A that are associated with Portal User B (i.e. in their Contact folder in a SharePoint library). Specifically, in the case that Contact A has a Connection (in Dataverse) to Contact B, which translates in real life to a situation where A has been given permission to access B's SharePoint documents.
The lengthy (sorry!) bit of text that follows is an explanation of what I'm currently trying. If you already have a suggestion as to how this can be done, please skip all of this and send help just comment below.
We have existing SharePoint integration and are using the Document Locations form method to give the Portal User access to SharePoint files that live in a specific library, and a specific folder in that library that is associated with their Contact record. This works well, with the "Active Document Locations" view on a Table Form, which in turn is place on a Basic Form, which on the front-end is rendered as a navigable subgrid showing the Name and Modified On columns to the logged-in Portal User.
Separately to this, we have various custom tables that are used to store data related to the Contacts. And we also have a method that enables us to use the Connections feature to provide Portal User A with access to records that belong to / are related to Portal User B. To give a brief example using custom table "Business Stuff":
- Contacts A and B are connected. Contact A has custom Connection Role "Stuff Viewer" and Contact B has custom Connection Role "Stuff Owner".
- A custom table named "Business Stuff Connections" is populated via Flow on the creation of a Connection where the Role (To) is "Stuff Owner". For each "Business Stuff" row associated with Contact B, a "Business Stuff Connections" row is populated with the Lookup IDs of Contact A, Contact B and the Business Stuff row.
- The Flow also assigns Web Roles to each Contact based on their Connection Roles. These Web Roles are used for the Table Permissions that actually provide the access to the "Business Stuff" rows via the "Business Stuff Connections" rows.
- A Table Permission with access type Contact is created for the "Business Stuff Connections" table. Another Table Permission is created with access type Parent for the "Business Stuff" table, where the Parent is the "Business Stuff Connections" Table Permission.
- A View is created for the "Business Stuff" table that uses a complex filter on Contact and Connection. This filter will return rows that belong to a Contact with the Connection Role "Stuff Owner", where the logged-in Portal User (i.e. Contact A) accessing the View has the Connection Role "Stuff Viewer" connecting them to Contact B.
- This combination of custom table, Connection, Table Permissions and filtered View enables Contact A to log into the Portal, open a page with the View on it, and then see "Business Stuff" rows that are associated with Contact B rather than Contact A.
Now, my problem is trying to extend this method to documents/files that are stored in SharePoint. Up until now, we have only engaged with the Document Locations table that is a part of the SharePoint integration, in order to provide the logged-in Portal User access to their own documents. It's not possible to query the (SharePoint) Documents table, due to the error "SharePoint document entity does not support any view other than the associated grid view" - this is expected; I'm aware of some of the limitations of Dataverse–SharePoint integration.
What I would like to achieve, ideally, is to use my existing method in order to provide Contact A with access to Contact B's SharePoint documents - there would be, for example, a new custom table "SharePoint Document Connections" that is populated via Flow, which contains the IDs of the two Contacts as well as the ID of each Document inside the Document Location for that Contact. And then a Table Permission for the "SharePoint Document Connections" table would have access type Contact, and a second Table Permission on the SharePoint Documents table would have the "SharePoint Document Connections" table permission as a Parent. That daisy chain of IDs and permissions would theoretically provide the access, just as it does for the custom tables.
However, I cannot find a Document ID to use. The table (SharePoint) Documents has an ID that is a URI-encoded string resembling the Relative URL, and what I would need for my methodology is a straight Lookup ID - a Unique Identifier. Before I go wading into Power Automate's HTML request to see if I can possibly pull back a Document ID from SharePoint - am I completely off the rails here? Is it even possible to achieve what I'm trying to do here - i.e. let Contacts access each other's SharePoint documents (providing the Connection Role, Web Role and Table Permissions etc are in place)?
Very much in the weeds of this one - got a feeling my methodology won't fit here, but if it can work then I feel getting a unique identifier for each Document that Dataverse can work with is the key. If anyone has experience with this problem/requirement I'd very much love to hear how you approached this. Just to note, I am far more familiar with Dataverse/Portals than I am with SharePoint, so if I'm very luck I am missing something obvious in SharePointland.