Table of contents:
The topic: Add a "Open in Sharepoint" button to a gallery
You often want to display Sharepoint documents in a Power App. And this can be done very easily by adding a gallery and selecting the corresponding Sharepoint library as the items. Opening the document is then also very easy by adding a button or icon within the Gallery and adding the following formula to the OnSelect:
Launch("https://XXX.sharepoint.com/"&ThisItem.'Full Path')
But what if you also want to make other document actions available to users? For example, “Duplicate document”, “Send document by e-mail”, “Rename document” or “Download document”. We could recreate all these functions in Power Apps, but we all know that these functions are actually already available in Sharepoint. For this reason, a solution is shown below on how to display the document from the Power Apps Gallery directly in Sharepoint with an “Open in Sharepoint” button, similar to the one in Microsoft Teams.
The solution in a nutshell
Add a button within the gallery and name it “Open in Sharepoint”, for example. Then add the following formula to the OnSelect property:
Launch("https://XXX.sharepoint.com/SharepointDocumntLibrary1/Forms/AllItems.aspx?useFiltersInViewXml=1&FilterField1=ID&FilterValue1="&ThisItem.ID)
Now all you have to do is replace the yellow highlighted areas with your Sharepoint address and your Sharepoint library. And then you can give it a try.
The link does nothing other than open Sharepoint and filter on the “ID” field of the selected document. Since the Sharepoint ID column is unique, there will only ever be one hit and therefore display exactly this document.
Incidentally, you can also filter on any other Sharepoint column by adjusting the Filter1 part of the formula accordingly. Have fun!
Do you like this article?
Please write a comment or leave a like below and follow me on LinkedIn.
If you have any questions, I'm happy to help.
Marc Sigrist (Powerfully GmbH, Switzerland)
コメント