cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beat
Advocate V
Advocate V

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

6 REPLIES 6
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.

Beat
Advocate V
Advocate V

@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

Beat
Advocate V
Advocate V

@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. 

Beat
Advocate V
Advocate V

@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.

@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 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,605)