cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

attachment content cannot be null or empty

My flow stopped working all of a sudden, getting Parameter 'Attachment Content' cannot be null or empty. 

It's a pretty simple flow. I get the content of an .xlsx file, make a backup copy into the same folder (which works fine) then I use the  file content for the attachment in the send an email (V2) action, which fails:
get file content and make a copyget file content and make a copyuse same content for the attachmentuse same content for the attachment

Looking at the run history I can see the following:
Get file content raw outputs:

 "body": {
        "$content-type""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        "$content""UEsDBBQABgAIAAAAIQCRWbXtlwEAABkHAAATAAgCW0NvbnRlbnRfVHl....... etc.
Send an email (V2) raw inputs:
 "emailMessage/Attachments": [
            {
                "Name""EMP Request for ZFD XX-ISP-9999 Testing Workflow please ignore.xlsx",
                "ContentBytes"null
            }
 
What could be the reason that the raw inputs are null while the outputs show content? Where's the disconnect, and more importantly what could have been causing it? 
1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

I don't like it when flows that had been working suddenly fail.

I can only suggest that you try:

  • delete the email attachment name and content (i.e. no attachment content), save the flow, close and re-open the flow. Re-test.
  • Or, delete the Send an Email action, save and then re-create the Send and Email action. Re-test.

to fix, for whatever reason, any hidden "corruption" in the flow or some other change in the SharePoint back-end?


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

7 REPLIES 7
ekarim2020
Super User
Super User

I don't like it when flows that had been working suddenly fail.

I can only suggest that you try:

  • delete the email attachment name and content (i.e. no attachment content), save the flow, close and re-open the flow. Re-test.
  • Or, delete the Send an Email action, save and then re-create the Send and Email action. Re-test.

to fix, for whatever reason, any hidden "corruption" in the flow or some other change in the SharePoint back-end?


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

Anonymous
Not applicable

@ekarim2020 thanks for your suggestions. I tested the first option extensively, to no avail. However I discovered some interesting fact. In one of the tests, I forgot to add the .xlsx extension in the attachment name, and the flow completed successfully! The mail was sent, attachment with no file extension, but when detached and saved as .xlsx, it opens fine.

I tested with both,  Infer Content Type in the Get file content action Yes or No, but it makes no difference. 

Attachment name = xlsx extension.xlsx

Get file contents output:

xlsx extension infer data type yes outputs.png

Attachment inputs:
xlsx extension infer data type yes inputs.png

The flow fails with attachment cannot be null or empty.

Attachment name = no file extension

Get file contents output:
no file extension infer data type yes outputs.png

Attachment inputs:

no file extension infer data type yes inputs.png

The flow completes successfully, but the attachment in the mail has no extension and must be saved as .xlsx locally before it can be opened or processed further in the flow.

 

No matter if the content bytes are office xml format or octet stream, it works fine without file extension, but the content bytes input is null if the attachment name ends with .xlsx

 

I have another flow with exactly the same construct, and it continues to run fine. The only difference is that it's triggered by a SharePoint list item created or modified action, while the two that fail since Friday are triggered by a PowerApp button. 

 

(1) If you hardcode the attachment file name in to the send mail action, is the attachment received and can it be opened?

2021-11-16_17-11-24.png

 

(2) Test with a simple flow: Get File content, Send Mail:

2021-11-16_17-23-34.png

 

If the basic flow works, we can then add further actions later.

 

Let me know.

 

Ellis

Anonymous
Not applicable

@ekarim2020 I've hardcoded the filename for my tests. The flow fails if the attachment name ends with .xlsx, it works fine without extension or with no attachment at all. The parameters passed to the PowerApps run command behave correctly, all is fine as long as there is no attachment or the attachment name doesn't end with .xlsx. 

Anonymous
Not applicable

@ekarim2020  Tested with a simple flow just consisting of these two steps, 

 

simple flow.png

Working as expected:

test with extension.png

Will now try and re-create the entire Send an email action from scratch.

Anonymous
Not applicable

@ekarim2020 option 2 did the trick, no point in messing with the attachment, it's the whole step that needs to be re-created. 

- Edit the original flow

- Expand advanced options of the failing step

- Take a screenshot

- Delete the step

- Re-create it exactly as it was

- Succeed 

Thanks! Solved it too by deleting the attachment parameters in the send email action, then saved, then added again. Great.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,101)