Hello,
I am making an app that is suposed to allow users to have acces to the folders they have the rights for.
In my case, I have folders in a sharepoint Documents library: "Chantier 1", "Chantier 2" and "Chantier 3" (Filter is used to simulate folders and subfiles)
I created a sharepoint list to manage access (A or B, I'd prefer A but I don't know which one would be best for powerapps to works)
I have 2 Users, (User1, User2), and an "X" indicate if they have the rights (User1 can access Chantier 1 and 3 while User2 can access Chantier 2 and 3)
I'm looking for a way to only show in my gallery folders who aren't blank in my sharepoint list for a specific user, the result should be like the 2 exemples at the botom of my pic (I'd like it to be "global" as I will have more users and more folders)
Thanks for your help
Solved! Go to Solution.
@Anonymous
As a matter of fact, your soltion got me thinking and I found how to do it in an even simpler way for the userHere's my solution, I created a multiple choice column in my sharepoint list (Chantiers) with each folder as a proposition (Chantier 1; Chantier 2; Chantier 3;...)
My first gallery is looking up for the choices selected for the current user based on his Email (Lower is because some adresses use capital letters) and is displaying its value in the text
The second gallery is using this selected value to complete the path of the folder.
Thanks a lot anyway
Personally, I'd manage access with a List schema setup like this, ie Option "C"
User || Fonction || Folder
This would be easier to manage IMO.
You could then set your app up in the following way (Note: my code uses different language settings to to you so you will need to adjust it for that:
In the App OnStart add
Set(vUser, User())
Then, on your gallery screen add a Flexible Height gallery with the Items code set as
Filter(Documents, User = vUser.FullName)
Note: User is a Single Line of text field in your List and holds the FullName (matching) of your users.
The Flexible Height gallery will collapse and expand to suit user access as it changes.
Hi,
thanks for your help.
I set v.User in the App OnStart and added the flexible height gallery but it doesn't seem to work, the gallery stays blank
I don't understand how you make the connection between the datasource of the gallery (Documents) and the sharepoint list (Attribution) that I want to use to filter the results.
Ah sorry, you are correct. I rushed my response and didn't quite think it through. Firstly though, you need to correct you reference table in that there should only be one Folder column, not a column for each folder, eg
John Doe RA. Chantier 1
John Doe RA. Chantier 3
Alex Lee. OP. Chantier 2
Alex Lee. OP Chantier 3
Then, in the App OnStart and after setting the User variable, add this
ClearCollect(userFolders, Filter(yourListName, User = vUser.FullName))
Then the gallery Items could be set to
Filter(Documents, folderColumnName in userFolders.FolderCol)
This will likely throw a delegation warning, however, unless you plan on using 2000+ folder names it shouldn't be an issue.
@Anonymous
As a matter of fact, your soltion got me thinking and I found how to do it in an even simpler way for the userHere's my solution, I created a multiple choice column in my sharepoint list (Chantiers) with each folder as a proposition (Chantier 1; Chantier 2; Chantier 3;...)
My first gallery is looking up for the choices selected for the current user based on his Email (Lower is because some adresses use capital letters) and is displaying its value in the text
The second gallery is using this selected value to complete the path of the folder.
Thanks a lot anyway
User | Count |
---|---|
257 | |
110 | |
90 | |
51 | |
44 |