Canvas Apps Controls

U – Upload – How to upload attachments?

A bunch of files and folders
A bunch of files and folders

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:

  1. Add an edit form.
  2. Connect it to a table like Accounts (if you are using Dataverse).
  3. Add the attachments field if it doesn't get added automatically to the form.
  4. Unlock its data card.
  5. Cut the control and paste it outside the form.
  6. 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:

Attachment control
Download files

Stay tuned for the remaining 5 tips!

Recent articles

Leave a Reply