I have a table "Person" and a table "Files" in the dataverse.
Each person can have multiple files (one to many).
I can't seem to find a way to download the files that are related to a person. Is there anyone that has experience with this?
Thanks in advance
Is the "Files" a standard table or are you talking about attachments? if this is a standard table there are a number of methods you can utilize to accomplish this.
What I am most familiar with:
1. Create a model driven Power App that contains the tables you are working with or utilize really any model app that already exists in the environment and make sure your user has a role that allows viewing the data from these tables.
2. Utilize Advanced Find in the Model App to select the Files records related to a specific lookup value from the Person table to the person you want. You can add the columns you would like to export etc. here as well.
I know the above isn't exactly your situation but similar where I am selecting Opportunity table records where the Account (lookup field on Opportunity) is equal to a specific value. This would be similar for you situation but you would be looking at the Person lookup column on the Files table.
3. Another option is to create a view on the Files table in the dataverse that contains the lookup column for the Person and then all the columns you require from the Files table. You can then add the Files table to your model application and select this view and filter by the appropriate value in the Lookup to the Person you would like.
Hope this helps.
Thanks for your input 🙂
The files table is a custom table that I added in the dataverse.
I'm also using a canvas app so I can't really use your suggestions in my case.
What I do now is take the attachment input control and put it in a gallery which items are set to a person his files.
For example: varPerson.Files.
This works and shows the files, but when I press them it tries to download the files but then I get the error message 'couldn't download - no file" which makes sense because the url looks like this
Do you know if there's a way to get the url to download a file from a record in a table?
Thanks in advance
If you using the file column type, see this documentation on how to download via the Web API or .NET: https://docs.microsoft.com/powerapps/developer/data-platform/file-attributes
If using Power Automate, see this: https://docs.microsoft.com/power-automate/dataverse/upload-download-file
Sorry for the links, but they explain it better than me 🙂
Hope this helps!
To add to @EricRegnier's response, using Power Automate you can download the file to OneDrive or SharePoint and manually get to it that way.
To download it directly to the local workstation from a Canvas app you'll need to develop a custom PCF control, or a Custom Connector. Your custom connector could be a wrapper around an Azure Logic App that accepts an HTTP POST request that returns an HTTP response that downloads the file directly (you can't use an HTTP GET because Logic Apps and Power Automate strip out Content-Disposition HTTP headers that tells the browser how to download the file, where with a POST request these headers don't get stripped) .
Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.
Not exactly the same scenario, but I am using Power Automate to upload a CSV file into a Dataverse table and then making it available in a Canvas app for a user to download. This section of the flow adds a new row to Dataverse, uploads the file using the CSV table content and then formats the URL of the csv file:
I then send this URL back to Power Apps:
From where the user is able to download it in the Canvas app. The code below allows the user to click a "Generate CSV" button, which will format the data in JSON, send it to the Power Automate flow to create and upload the csv into Dataverse, and then download the csv to the users computer:
Thank you @PowerPAC , that odata id + file column + $value was the last piece I needed to do something similar with as few button clicks as possible by the users!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.