I have a Flow that has been working flawlessly up until 2 weeks ago. Now, each time I run the flow I get the following error:
InvalidTemplate. Unable to process template language expressions in action 'Append_to_array_variable' inputs at line '1' and column '2330': 'The template language expression 'body('Get_attachment_content')?['$content']' cannot be evaluated because property '$content' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'.
This particular flow is supposed to send multiple attachments in an email when a new SharePoint list item is created. This WAS working just fine but all of a sudden stopped.
In order to get the $content for "ContentBytes", I used the following expression: body('Get_attachment_content').$content and it saved as $content. Detailed steps for this Flow can be found on my blog: Emailing List Attachments in Office 365
I have added a screenshot of the Flow itself. Any help on this would be greatly appreciated, I have just about given up on this.
Solved! Go to Solution.
Hi @BigE,
Could you please show a bit more about the Attachment files of the new created item?
I have made a test on my side and don't have the issue that you mentioned. My flow's configuration as below;
Within "Append to array variable" action, Value field set to following json data:
The corresponding value of the ContentBytes key set to following formula:
body('Get_attachment_content')?['$content']
Note: The Attachment files are PDF file and Excel file on my side.
The flow works successfully as below:
The error message told that the $content property could not detected using the 'body('Get_attachment_content')?['$content']' within your "Append to array variable" action. I have made a test on my side, if the attachment file is a .txt file, the error would show up as you mentioned.
Please check if the Attachment files of the new created item contain .txt file, if the Attachment files contain .txt file, the result the 'body('Get_attachment_content')?['$content']' expression returned doesn't contain the $content property.
Best regards,
Kris
@Anonymous / @mahesh_mohan ,
Someone replied back to me on my blog post about this stating they found a work around:
You have to enclose the body function with a base64 function to encode the txt file ( I added an if statement to see if the attachment ended with .txt to determine if I had to add the encoding or not)
I attempted this but did not have much time to devote to it so I moved on. Feel free to try it and let me know if it works.
-Eric
Hi @BigE,
Could you please show a bit more about the Attachment files of the new created item?
I have made a test on my side and don't have the issue that you mentioned. My flow's configuration as below;
Within "Append to array variable" action, Value field set to following json data:
The corresponding value of the ContentBytes key set to following formula:
body('Get_attachment_content')?['$content']
Note: The Attachment files are PDF file and Excel file on my side.
The flow works successfully as below:
The error message told that the $content property could not detected using the 'body('Get_attachment_content')?['$content']' within your "Append to array variable" action. I have made a test on my side, if the attachment file is a .txt file, the error would show up as you mentioned.
Please check if the Attachment files of the new created item contain .txt file, if the Attachment files contain .txt file, the result the 'body('Get_attachment_content')?['$content']' expression returned doesn't contain the $content property.
Best regards,
Kris
So yeah, I tested with an image just now and the Flow ran as expected. It seems to just fail when a .txt file is attached. I wonder what the limitation is in regards to attaching a text file?
Is there any solution for this issue? Even i am also having the same issue.
Hello! Thanks for the detailed solution.
Just to be clear, .txt files are not supported at this time? Is there a documented list of approved filetypes for the Get Attachment Content function?
@Anonymous / @mahesh_mohan ,
Someone replied back to me on my blog post about this stating they found a work around:
You have to enclose the body function with a base64 function to encode the txt file ( I added an if statement to see if the attachment ended with .txt to determine if I had to add the encoding or not)
I attempted this but did not have much time to devote to it so I moved on. Feel free to try it and let me know if it works.
-Eric
This works an absolute treat with .ICS files as well as I found they are formatted as text.
Thanks!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
5 | |
3 | |
3 | |
2 | |
2 |
User | Count |
---|---|
14 | |
12 | |
8 | |
8 | |
6 |