Vienna Power Apps and Power Automate User Group

Please login or click SIGN UP FOR FREE to create your PowerPlatformUG account to join this user group.
Expand all | Collapse all

"Attachments", a powerful, hidden control in PowerApps

  • 1.  "Attachments", a powerful, hidden control in PowerApps

    Posted Mar 09, 2020 10:07 AM

    Azure Blob Storage is a fast, easy, and economical option to store files (i.e. blobs) which can also be used with Microsoft PowerApps.

    When first using it, however, I quickly stumbled upon a major question: So... how do I upload files now??

    PowerApps has one control called "Add Picture" which upon clicking enables you to choose from all the image files on a device. So far so good... but Blob Storage can't just handle pictures, but all kinds of files (documents, audio, etc.).
    What one COULD do is to (at least on PC) just tell users to change the filter in explorer from "Image Files" to "All Files", but that's not really convenient, is it?


    Instead, one could choose a more elegant solution and use the "Attachments" control. With this control, one cannot only add all kinds of files by default, but can also limit the number of files allowed in one "run" as well as file size.


    In my experience it is best to always limit the maximum attachments at a time to 1 in order to minimize upload time and error potential.
    After the attachment has been selected, the control notifies the user that the limit has been reached:

    Then, the file content can be accessed by typing:
    First(AttachmentsAdd_1.Attachments).Value
    The file name can be accessed by typing
    First(AttachmentsAdd_1.Attachments).Name​
    ​There are of course more properties which can be used in various types of formulae, but I won't list all of them now.

    After a successful upload to Azure Blob Storage (or any other target), the Attachments control can be reset, whereupon users can proceed with the next file(s).

    So... why did I call this a "hidden" control in the title of this entry?
    Because there is no regular way one can insert this control from the insert pane in the menu. In order to get the attachment control, one has to do the following things:
    • Connect to a data source supporting attachments (like a CDS entity)
    • Insert a form
    • Connect the form to the entity and add the "field" called "Attachments" to the form.
    • Copy the attachments control out of the form and use it wherever you want.

    Have fun storing your data ;)

    ------------------------------
    Christoph Gschliesser
    Product Manager
    BE-terna GmbH
    Innsbruck
    ------------------------------


  • 2.  RE: "Attachments", a powerful, hidden control in PowerApps

    Posted Mar 11, 2020 04:07 AM
    Edited by Michael Wickert Mar 11, 2020 06:16 AM
    PowerApps upload file to SharePoint document library - Shane Young
    https://www.youtube.com/watch?v=3QaiM8SeWfM

    PowerApps Attachment Control - Upload All Files not Images Only to Azure Blob Storage - Shane Young

    https://www.youtube.com/watch?v=Pa-pYEkLH-U

    PowerApps Attachments - Saved to Azure Blob Storage with SharePoint and SQL - Shane Young

    https://www.youtube.com/watch?v=ZOz3HvKDWMk


    Best regards to BE-terna from a customer ;-)



    ------------------------------
    Michael Wickert
    Meissen
    ------------------------------