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

Invalid AttachmentName with trigger manual (mutiple file upload) and start approval

Hi,

I got several error on file name while attempting getting file from manual trigger (3 files upload enable). Photo is too large so i copy code 

Manual input

 

"file": {
                    "title""Quotation",
                    "type""object",
                    "x-ms-dynamically-added"true,
                    "description""Please select file or image",
                    "x-ms-content-hint""FILE",
                    "properties": {
                        "name": {
                            "type""string"
                        },
                        "contentBytes": {
                            "type""string",
                            "format""byte"
                        }
                    }
                },
                "file_1": {
                    "title""Reference ",
                    "type""object",
                    "x-ms-dynamically-added"true,
                    "description""Please select file or image",
                    "x-ms-content-hint""FILE",
                    "properties": {
                        "name": {
                            "type""string"
                        },
                        "contentBytes": {
                            "type""string",
                            "format""byte"
                        }
                    }
                },
                "text_3": {
                    "title""Job Number",
                    "type""string",
                    "x-ms-dynamically-added"true,
                    "description""Please enter your input",
                    "x-ms-content-hint""TEXT"
                },
                "file_2": {
                    "title""Price compare",
                    "type""object",
                    "x-ms-dynamically-added"true,
                    "description""Please select file or image",
                    "x-ms-content-hint""FILE",
                    "properties": {
                        "name": {
                            "type""string"
                        },
                        "contentBytes": {
                            "type""string",
                            "format""byte"

 

 

Action where error occurred

"attachments": [
                {
                    "name""@{triggerBody()?['file']?['name']}",
                    "content""@{triggerBody()?['file']?['contentBytes']}"
                },
                {
                    "name""@{triggerBody()?['file_1']?['name']}",
                    "content""@{triggerBody()?['file_1']?['contentBytes']}"
                },
                {
                    "name""@{triggerBody()?['file_2']?['name']}",
                    "content""@{triggerBody()?['file_2']?['contentBytes']}"
 
 I always got error message BadRequest. The request failed. Error code: 'InvalidAttachmentName'. Error Message: 'The attachment name '' is invalid.'.
 
I also tried with     ;  string(triggerBody()?['file']?['name']) but still error
 
What should I do?
1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi @PamelaReeve27 ,

 

I could reproduce the same issue on my side.

Please ensure you have upload three files when you testing the flow.

This is  my test result:

8.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
abm
Super User
Super User

Hi @PamelaReeve27 

 

 

Add a compose and map the filename.

 

So for my example below

image.png

 

Above Compose action is mapped the below. You can find the value by clicking the three dots and see the peek code.
 
@triggerBody()['text']
 
Yes I agree it doesn't reflect the actual display name (filename) you using in the input field.
 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
efialttes
Super User
Super User

Hi!

Are you uploading the three files? I mean, are all of them mandatory in your manual trigger input?

THanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Not all mandatory, only 1 file ; 'Quotation'

Hi @PamelaReeve27 

 

Try the compose and view the code. That will do the right expression for you to map.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

 

Hi @PamelaReeve27 ,

 

I could reproduce the same issue on my side.

Please ensure you have upload three files when you testing the flow.

This is  my test result:

8.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

 

Hi @PamelaReeve27 ,

 

If you want dynamically upload files, you could check the configuration of the Attachment. You could import it as a new flow and check if it helps.

import-export-bap-packages 

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PamelaReeve27
Frequent Visitor

I did try to recreate flow and finally found that once I setup manually trigger input for 'file', it requires upload file, could not leave blank even I setup as optional. I guess when I conduct trigger as attachment but file left blank. MS flow itselves can't understand so it erros. 

Thank you guys for suggestions. I may ask more as i'm beginner to MS flow.

 

BRs,

Pamela

 

Hi @PamelaReeve27 ,

 

Yep, if you have added file input in the manual button, you need to upload files when you running the flow.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,846)