cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jstryk
Frequent Visitor

Syntax for combining FileArray and a static object/file

I cannot get a combination of a filearray and a static file to attach to an email. The raw text looks like this. The email sends successfully but doesn't attach anything. If i just use the "FilesArray" dynamic content it works fine and if I just use the static file it works, but the combination doesn't. I'm sure its a syntax issue but no combination seems to be working for me.

[

{"@{variables('filesarray')} "
},
{
"Name": "Triage Letter.pdf",
"ContentBytes": "@{base64(body('Get_file_content_using_path_pdf'))}"
}
]

 

I was basing this around the raw text from the alternate view on another email using the send email V2 that has the "Attachment name" and "Attachment content" fields.

 

 

 

jstryk_0-1611682487259.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @jstryk :

Could you tell me:

  • What is filesarray's data type?Is it an array?

If so,the point is Data type issues.

  • The data structure of {"@{variables('filesarray')} "} is that an array is nested in Object.
  • The data structure of {
    "Name": "Triage Letter.pdf",
    "ContentBytes": "@{base64(body('Get_file_content_using_path_pdf'))}"
    } is a pure Object

To solve this problem, I suggest you to append static files to this array first, and then use this array directly.Something like:
2.JPG

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @jstryk :

Could you tell me:

  • What is filesarray's data type?Is it an array?

If so,the point is Data type issues.

  • The data structure of {"@{variables('filesarray')} "} is that an array is nested in Object.
  • The data structure of {
    "Name": "Triage Letter.pdf",
    "ContentBytes": "@{base64(body('Get_file_content_using_path_pdf'))}"
    } is a pure Object

To solve this problem, I suggest you to append static files to this array first, and then use this array directly.Something like:
2.JPG

Best Regards,

Bof

This was more or less my problem though my work around was to use "get file content by path" and "get file metadata by path" to pull dynamic content to append to the FileArray variable like this. 

 {
"ContentBytes": @{body('Get_file_content_using_path_pdf')['$content']},
"Name": @{body('Get_file_metadata_using_path1')?['DisplayName']}
}

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 (2,233)