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

Community site session details

Session Id : 76wdEFr65gvj192QLPRUN2
Power Apps - Building Power Apps
Unanswered

Uploading photos to CDS entity

Like (0) ShareShare
ReportReport
Posted on 10 Oct 2019 14:25:54 by 241

I'm creating an app that allows users to create various registrations. These registrations might include a photo they have to take on the spot with the device camera. What's the best way to achieve this? (Everything is purely based on CDS)

 

My first approach was to add an 'Image' field to my entity, and Patch the photo to that field. However, I found that this will simply create a super compressed 'entity image' that is useless in practice.

 

I'm now looking at enabling Notes for the registration entity, and add the photo as a notes attachment to the registration. However will it be possible this way? I was playing around a bit like this:

// test sending photo as notes attachment
Patch( Notes, Defaults(Notes), {
 subject:"Photo test",
 notetext:"Description text",
 filename: "photo.jpg",
 _objectid_value: First(Accounts),
 documentbody: PhotoDialog_1.Foto, // note to reader: this is the output of an 'Add picture' control (AddMediaButton.Media)
 isdocument:true
 } );


However, this is simply giving me an OData exception when executed:

odata.jpg

  • MrNappa Profile Picture
    241 on 15 Oct 2019 at 14:38:57
    Re: Uploading photos to CDS entity

    @v-monli-msft wrote:

    Hi @MrNappa ,

     

    If you mean that you want to take a picture with Camera control and then upload this photo as the attachments of your CDS entity, then I'm afraid that this cannot be achieved so far. 

     

    You can only upload existing photo files as the attachments using Attachments control inside an edit form. For more information, please refer to:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-attachments

     

    Regards,

    Mona


    Do you know if this will be possible in the future? It seems like a blatant omission in functionality... Or do I have to carry myself over to the ideas forum again... 😅

     

    Also, I've been experimenting with a different data connector to achieve this. If I add the 'Notes' as a 'Dynamics 365' data source instead, and use this code to do the patch:

    Patch( Notes,Defaults(Notes), {
     subject:"subject",
     notetext:"description",
     _objectid_type:"accounts",
     _objectid_value: First(Accounts).Account,
     filename: "photo.jpg",
     documentbody: base64data
    });

    It seems to be successful. But is it a good idea to mix CDS with D365 connectors? I'm also not entirely sure how the authentication of the D365 connector is set as opposed to the CDS data source.

  • MrNappa Profile Picture
    241 on 15 Oct 2019 at 12:04:45
    Re: Uploading photos to CDS entity

    @Lars4 wrote:

    Another (not perfect I guess) option is to store the base64 string representing the photo into a multiline text field. 


    Hm, yeah that's not ideal, because it will require further processing with a plugin (or maybe flow?). Then again, if it's the only way...

  • v-monli-msft Profile Picture
    on 11 Oct 2019 at 07:56:55
    Re: Uploading photos to CDS entity

    Hi @MrNappa ,

     

    If you mean that you want to take a picture with Camera control and then upload this photo as the attachments of your CDS entity, then I'm afraid that this cannot be achieved so far. 

     

    You can only upload existing photo files as the attachments using Attachments control inside an edit form. For more information, please refer to:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-attachments

     

    Regards,

    Mona

     

     

     

  • Lars4 Profile Picture
    92 on 11 Oct 2019 at 06:46:27
    Re: Uploading photos to CDS entity

    Another (not perfect I guess) option is to store the base64 string representing the photo into a multiline text field. 

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete