web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / View Attachement from ...
Power Pages
Unanswered

View Attachement from Dataverse in Form / Page

(0) ShareShare
ReportReport
Posted on by 22

Hello everyone,

 

I have a Power Page with a Form which is built on a Dataverse table. This Form allows the User to upload attachements

and after a lot of research, I learned, that the Attachement isn't saved directly in the underlying table but instead in another System table named 'annotations' (or notes, according to the original article I had read?).

 

Now I want to have another Form which will allow a different set of Users to view and edit entries in my original Dataverse table (the one with the Form) - not a big Problem, except for the attachements. 

I can't figure out how to add the attachements to a form or page in order to allow my Users to view/download the attachements.

 

Any advice is appreciated! ❤️

 

Regards,

MiniDev

Categories:
I have the same question (0)
  • oliver.rodrigues Profile Picture
    9,368 Most Valuable Professional on at
  • Squire4Hire Profile Picture
    125 on at

    Isn't this the opposite of what OP is asking for?

  • Fubar Profile Picture
    8,340 Super User 2025 Season 2 on at

    @Squire4Hire it is correct.  On the metadata record you can specify Create/Edit/Delete, and the Table needs to be enabled for notes etc etc all as per the first link provided.

     

    @MiniDev  On a Edit form just use a metadata record as per the link Oliver provided (don't forget the Table permissions on that page also). On an Insert form alternatively you can set  File attach options on Forms definition..

     

    FYI: Notes is the Tables display name, annotation is its logical schema name (e.g. in the user interface you will see the Table as Notes but if you need to do something in code it is annotation that you are dealing with).

  • Squire4Hire Profile Picture
    125 on at

    @Fubar, neither you or @OliverRodrigues address OP's question (and as far as I can tell, it's not addressed on the documentation you linked) -- "I can't figure out how to add the attachements to a form or page in order to allow my Users to view/download the attachements."

  • Squire4Hire Profile Picture
    125 on at

    The same question is asked here and remains unanswered.

  • Fubar Profile Picture
    8,340 Super User 2025 Season 2 on at

    @Squire4Hire wrote:

    @Fubar, neither you or @OliverRodrigues address OP's question (and as far as I can tell, it's not addressed on the documentation you linked) -- "I can't figure out how to add the attachements to a form or page in order to allow my Users to view/download the attachements."


    How about you let the OP decide if what has been provided answers their question or not - and if not answered clarify what they are after. Be aware this is community support the time that people like Oliver, myself and others spend here is not paid for by anyone - 'calling people out' is not appreciated.

  • Fubar Profile Picture
    8,340 Super User 2025 Season 2 on at

    @Squire4Hire wrote:

    The same question is asked here and remains unanswered.


    It is not actually the same question.  The question being asked on the other post is how to render an image that is stored in a notes attachment on the page.

     

    In most cases Notes attachments are not images (but they can be).  Having a timeline control and the metadata will provide a clickable link that will allow the browser to download the attachment or if the Browser has appropriate add-ins (browser add-ins nothing to do with the Portal) open in a browser tab.

     

    To render an image, you would need to customize things and use Liquid and fetchXML, or the Portals Web API to extract the body and then put it as an img tags source (can't remember for img src but you may also have to  base64 decode it also)

  • Fubar Profile Picture
    8,340 Super User 2025 Season 2 on at

    @MiniDev one thing I hadn't realized is that the metadata Edit will only work for the Portal User that uploaded the attachment, download and create is still available to anyone with Table Permissions to read/create it.

     

    Also if you have a Notes attachment created from Dataverse e.g. Model Driven App, if you want it to be displayed on the timeline on the portal you need to prefix the note Description with *Web*

  • Squire4Hire Profile Picture
    125 on at

    @FubarI'm not calling anyone out. I'm pointing out that a response without quality is not a response at all.

     

    While you may feel that the time and effort to post a link to a page that does not actually address a question is not being appreciated, I feel as though it's a huge disservice to the entire community and a waste of everyone's time in trying to find answers to questions that are being asked. It comes from a place of frustration and is not a personal attack.

     

    Sure, it may be up to OP to determine if the answer is sufficient for them, but I don't think there's anything wrong with pointing out how an answer lacks substance or misdirects anyone else looking to solve the same problem(s).

     

    I appreciate the fact that you took a bit more time to outline the potential possibility that a file can somehow be retrieved from the Note table. At least it's a place to start.

  • Squire4Hire Profile Picture
    125 on at

    @MiniDev- This is how I was finally able to do it...

    You're correct that files are uploaded/stored in the Note (annotations) table when you use the File Attachments control on a form. Using FetchXml, you can link to the annotations table in order to get/show the required fields necessary. You're going to need the related mimetype and documentbody fields at a minimum, and will likely need the filename field too. It would look something like this:

    {% fetchxml files %}
     <fetch mapping='logical'>
     <entity name="your_tables_logical_name">
     <attribute name="a_column_from_the_parent_table" />
     <attribute name="another_column_from_the_parent_table" />
     <link-entity name="annotation" from="objectid" to="your_tables_logical_nameid" link-type="outer" alias="your_alias">
     <attribute name="filename" />
     <attribute name="mimetype" />
     <attribute name="documentbody" />
     </link-entity>
     </entity>
     </fetch>
    {% endfetchxml %}

     

    I assume you know where to get the logical names for the table and columns If not, you can go to Data in the Design Studio and look at the associate Table Properties and Column Properties.

     

    Once you've fetched the data with the linked notes items, you can iterate through them and use the Base64 encoding of the documentbody with the mimetype to either display the image or download the document. It would look something like this:

     

    <div class="row">
     {% if files.results.entities.size > 0 %}
     {% for file in files.results.entities %}
     <div class="col-lg-6">
     <p>{{ file.a_column_name_from_the_parent }}</p>
     <img src="data:{{ file['your_alias.mimetype'] }};base64,{{ bio['your_alias.documentbody'] }}" />
     <a href="data:{{ file['your_alias.mimetype'] }};base64,{{ bio['your_alias.documentbody'] }}" download={{ file['your_alias.filename'] }}> Download Link </a>
     </div>
     {% endfor %}
     {% endif %}
    </div>

     

    Notes:

    - The <img> tag will display the image on screen

    - The <a> tag with the 'download' attribute will allow the user to download the file by clicking on the link and will assign the stored document filename as the default filename.

    - your_alias can be anything you want, but it is required for the linked entities to function properly.

    - This should work for any images and document types, but you may need to adjust it accordingly for any other file types.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard