cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Maurits
Level 8

How to display CDS attachment image?

Hi, hope somebody can help me. We add attachments like images to notes/annotations in the CDS.

There are great blogs on camera integration to do so. 

But I try to show the attached images in a PowerApp, which fails.

Found some blogs on how to show images from SharePoint lists attachments in a gallery, but somehow I can't get this to work with the CDS attachment. 

I receive the attachment.body with the textual content.

Is there a way to assign this to a image object or so?

 

Maurits

1 ACCEPTED SOLUTION

Accepted Solutions
Maurits
Level 8

Re: How to display CDS attachment image?

Solved it. FYI if someone else want to do the same:

Apparently the data stored with the attachments are not complete because the Canvas App used deletes the first part of it. Otherwise the result would't be usable jpg or png files.
When showing these files, the removed part of the text must be added first.
E.g. see code below when using the Notes entity.

 

Switch(
    Right(
        ThisItem.'File Name';
        3
    );
    "png";
    Concatenate(
        "data:image/png;base64,";
        ThisItem.Document
    );
    "jpg";
      Concatenate(
        "data:image/jpg;base64,";
        ThisItem.Document
    )  
)
1 REPLY 1
Maurits
Level 8

Re: How to display CDS attachment image?

Solved it. FYI if someone else want to do the same:

Apparently the data stored with the attachments are not complete because the Canvas App used deletes the first part of it. Otherwise the result would't be usable jpg or png files.
When showing these files, the removed part of the text must be added first.
E.g. see code below when using the Notes entity.

 

Switch(
    Right(
        ThisItem.'File Name';
        3
    );
    "png";
    Concatenate(
        "data:image/png;base64,";
        ThisItem.Document
    );
    "jpg";
      Concatenate(
        "data:image/jpg;base64,";
        ThisItem.Document
    )  
)

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 382 members 4,265 guests
Please welcome our newest community members: