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

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

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,318)