cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TarenBhutch
Helper I
Helper I

Attachment error using send email V2

Hi,

 

I have created a Parent-Child workflow. One of the steps in the child flow is to send an email with an attachment. The email comes through successfully and an attachment is available. However, the issue is that with each scenario, the attachment is damaged or cannot be opened.

 

The workflow is triggered by the submission of a Power App form. The data for the submission is in a SharePoint Online list.

 

Do you have any suggestions for how to resolve this?

 

Thank you in advanced!

 

Attachment workflow settingsAttachment workflow settings

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Attachment added to emailAttachment added to email

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.msg error.msg error.pdf error.pdf error

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @TarenBhutch ,

 

The content-type and content are the two parts of the body('Get_attachment_content'). The  body('Get_attachment_content') is the output of the Get attachment content action. 

 

Snag_1598138f.png

You have two options:

 

(1) You can try to copy-and-paste the following directly into your Append to Array variable action : 

 

 

{
  "Name": @{items('Apply_to_each')?['DisplayName']},
  "ContentBytes": {
    "$content-type": @{body('Get_attachment_content')?['$content-type']},
    "$content": @{body('Get_attachment_content')?['$content']}
  }
}

 

 

(2) Or type the expressions by hand:

Snag_15905c09.png

 

Snag_159d9e72.png

The expressions that you can copy-and-paste:

 

body('Get_attachment_content')?['$content-type']
body('Get_attachment_content')?['$content']

 

 

See: Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails – Ellis Karim's B...

 

 

Hope this helps.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
ekarim2020
Super User
Super User

Hi @TarenBhutch ,

 

Do you get the same issue with differnt PDF files and other Office documents such as Word?

 

In some instances the format of the attachment array does not work (i.e. the file attachment wont open), in that case try:

snag_9d63447.png

See: Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails 

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Hi @ekarim2020 , 

 

I don't seem to have the option to add the contentType and contentBytes from the dynamic content. Do you know if this is something that needs to be set in one of the prior steps?

TarenBhutch_0-1661828645552.png

 

Hi @TarenBhutch ,

 

The content-type and content are the two parts of the body('Get_attachment_content'). The  body('Get_attachment_content') is the output of the Get attachment content action. 

 

Snag_1598138f.png

You have two options:

 

(1) You can try to copy-and-paste the following directly into your Append to Array variable action : 

 

 

{
  "Name": @{items('Apply_to_each')?['DisplayName']},
  "ContentBytes": {
    "$content-type": @{body('Get_attachment_content')?['$content-type']},
    "$content": @{body('Get_attachment_content')?['$content']}
  }
}

 

 

(2) Or type the expressions by hand:

Snag_15905c09.png

 

Snag_159d9e72.png

The expressions that you can copy-and-paste:

 

body('Get_attachment_content')?['$content-type']
body('Get_attachment_content')?['$content']

 

 

See: Short Notes: The format of File Attachment Arrays for Approvals and Outlook Emails – Ellis Karim's B...

 

 

Hope this helps.

 


Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

Thank you @ekarim2020 this has worked perfectly!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,786)