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 Apps / sending attachment tho...
Power Apps
Unanswered

sending attachment though power apps to power automate but data is incomplete

(0) ShareShare
ReportReport
Posted on by 114

i made an app that upload its attachment to power automate so that i can send it to an email, here is formula am using to get attachment data:

 

Set(data, JSON(Image3.Image, JSONFormat.IncludeBinaryData));

Collect(rawdata, {contentBytes: Mid(data, Find(",", data)+1, Len(data) - Find(",", data) -1), name:Last(Ducements.Attachments).Name});

 

 

GTurkistane_0-1703756066758.png

 

and here is how it is sent to the flow:

 

SendEmailAttV2.Run(JSON(rawdata));

 

here is the flow am using to process the data nd send it in an email:

GTurkistane_1-1703756066640.png

 

Schema:

 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "name": {
 "type": "string"
 },
 "contentBytes": {
 "type": "string"
 }
 },
 "required": [
 "name",
 "contentBytes"
 ]
 }
}

 

GTurkistane_2-1703756066906.png

 

upon receiving the email, i can not open any of the attachment saying that it is corrupted, they all have correct names and types, here is the flow run:

 

 

GTurkistane_3-1703756066686.png

 

GTurkistane_4-1703756066936.png

 

GTurkistane_5-1703756066648.png

 

GTurkistane_6-1703756066856.png

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @GTurkistane ,

    Power Apps V2 saves all of that - instead of Input ask for a parameter of type File then

    SendEmailAttV2.Run(
     {
     file:
     {
     contentBytes: Last(Ducements.Attachments).Value
     name: Last(Ducements.Attachments).Name
     }
     }
    );

    and your Flow

     

    EmailAttachFlow.png

    Even easier, you do not need a Flow at all

    Office365Outlook.SendEmailV2(
     "ToHere",
     "SubjectHere",
     "BodyHere",
     {
     Attachments:
     {
     ContentBytes: Last(Ducements.Attachments).Value,
     Name: Last(Ducements.Attachments).Name
     }
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • GTurkistane Profile Picture
    114 on at

    thank you for your reply but your solution only works if you have one file, where am looking for a way to send multiple files, i know i can let the flow run multiple times but i want it to only send one email that contains all the attachments, also i am required t use flow other wise the second solution you sent would work.

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    @GTurkistane ,

    Then why are you using for the name

    name: Last(Ducements.Attachments).Name

    and for the image

    Image3.Image

    as this will only send the last file. However you can do this

    Office365Outlook.SendEmailV2(
     "ToHere",
     "SubjectHere",
     "BodyHere",
     {
     Attachments:
     RenameColumns(
     Ducements.Attachments,
     "Value",
     "ContentBytes"
     )
     }
    )

    Although I will have to pass if you have to use a Flow as I have never bothered trying to work out a complex solution when an easy one was available.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • GTurkistane Profile Picture
    114 on at

    thank you for your reply , let me clear how am doing things in my solution 

     

    i have the commands you mention on the attachment control's "onAddfile" section so that when you add any file this will happen:

     

    i get the name of the last file i added in the attachment control

     

    name: Last(Ducements.Attachments).Name

     

    , then using the image, i get the actual bytes of the file:

     

    Set(data, JSON(Image3.Image, JSONFormat.IncludeBinaryData));

     

    , after i get these 2 i add them to a collection as:

     

    Collect(rawdata, {contentBytes: Mid(data, Find(",", data)+1, Len(data) - Find(",", data) -1), name:Last(Ducements.Attachments).Name});

     

    this will allow me to be able to send multiple files to power automate, i am required to use power automate for this solution otherwise i would use your power apps standalone solution.

     

     

     

  • WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    @GTurkistane ,

    OK I get the first bit, but as I noted, I will have to pass on this one if you have to use a Flow (I am however wondering why as you could send the email and then do anything else needed in the Flow).

    I will note that your JSON schema and logic looks sound on the surface.

     

  • GTurkistane Profile Picture
    114 on at

    thank you the organization i train at demanded that emails are sent from power automate and not through power app for training and challenge proposes 

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard