Introduction
Uploading files and attachments is a use cases that I come across a lot. If you are connecting to a Dataverse table that has attachments enabled, you get an attachment control when you add a form to your app. But if I am not using a form, how do I use get that control? It isn't there in the list of controls under "Insert".
Uploading using attachment control
To get the attachment control, follow these steps:
- Add an edit form.
- Connect it to a table like Accounts (if you are using Dataverse).
- Add the attachments field if it doesn't get added automatically to the form.
- Unlock its data card.
- Cut the control and paste it outside the form.
- You will get a few errors due to the fact that some properties will have references to Parent (the form control). These should be pretty easy to fix.
You can not only use it to upload files but you can also use to display a list of files e.g. all files tied to accounts in an accounts gallery. All you need to do is to add the attachment control to a gallery. Set the Items property of the gallery to, say, the Accounts table. And finally, set the Items property of the attachment control to:
ThisItem.Attachments
Here is a quick demo:
Stay tuned for the remaining 5 tips!