cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jack08
Regular Visitor

How do stop MS Form file attachment name from being appended with "anonymous X"?

When a user attaches a file to our form that file named "Test Document 1" is renamed to "Test Document_anonymous 1".  Power Automate is sending the file via email and to a SharePoint site. It has the same new name in both places. How do I get it to send the file with its original name?

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Jack08 

 

Thanks for the screen share. So the expression for the filename we used is as follows:


concat(first(split(items('Apply_to_each_3')['name'],'_')),'.',last(split(items('Apply_to_each_3')['name'],'.')))

 

Then for the content 

 

body('Get_file_content')?['$content']

 

Finally mapped the filename and content under the array variable and Add attachment SharePoint action step.

 

Hope it make sense.

 

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

View solution in original post

8 REPLIES 8
abm
Super User
Super User

Hi @Jack08 

 

Could you post a screenshot of your flow? You could use a replace expression to remove "_anonymous 1' from the filename.



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
Jack08
Regular Visitor

Hi abm. Thanks for your response!  Below is the screenshot of the flow.

 

screencapture-make-powerapps-environments-Default-0eb48825-e871-4459-bc72-d0ecd68f1f39-logicflows-2021-06-21-14_04_13.png

Hi @Jack08 

 

Thanks for your reply. So what you need to do is add an expression like below where you mapping the filename.

 

first(split('YourFilenameDynamicVariable', '_'))

 

This will get you just the filename as 'Test Document'

 

If you want the extension then you need another split as well using '.' The use the last() expression to get the extension

 

last(split('YourFilenameDynamicVariable', '.'))

 

Finally using concat() expression you can get the full filename with extension.

 

concat(first(split('YourFilenameDynamicVariable', '_')), last(split('YourFilenameDynamicVariable', '.')))

 

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
Jack08
Regular Visitor

Hi abm, Thank you for your support with this. I am pretty new to Automate and I am not able to figure out where / how to put the lines of code you provided. (we would prefer the version that includes the file extension).  Can you provide any more details on how that is done? Thanks so much!!

abm
Super User
Super User

Hi @Jack08 

 

Thanks for the screen share. So the expression for the filename we used is as follows:


concat(first(split(items('Apply_to_each_3')['name'],'_')),'.',last(split(items('Apply_to_each_3')['name'],'.')))

 

Then for the content 

 

body('Get_file_content')?['$content']

 

Finally mapped the filename and content under the array variable and Add attachment SharePoint action step.

 

Hope it make sense.

 

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

View solution in original post

Jack08
Regular Visitor

Thank you Ajith!  You have been an amazing help. Incredibly knowledgable.I never would have been able to figure that out on my own.  Thank you!

MariusHz
Regular Visitor

It was really instructive this answer, thanks!! but I still have an issue when trying to open the attached files in the e-mail. I receive a message like the following (I think in the file content I ain't getting the correct data.

Error message:

"Excel cannot open the file 'xxxxx.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file".

 

Could you help?

Hi @MariusHz 

 

Could you please create a new thread and let me know?

 

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

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 (3,150)