cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alex_Reig
Helper III
Helper III

Rename email attachments from the subject text and save it in Dropbox

Hi all! 😊

 

I have already started using Power Automate and I’m trying to save the attachments from an email into my Dropbox changing its name for a part of the email subject.

 

Now I did a flow that can save the file but I’m not able to create the flow that change its name.

 

For example, I need to save and rename the file from this mail as Factura 757 – Hydrotech2 Europe SL not as 2021-757

 

Alex_Reig_0-1633531274516.png

 

 The flow that I have created is the following:

 

Alex_Reig_2-1633531308214.png

 

 

I think that the solution is to put something in “File Name” but everything I tried has failed.

Thanks so much for reading my problem, and I hope someone can help me out. 

 

Have a great day

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Alex_Reig 

Please add Get attachment action before Create file action and use 'Content Bytes' from Get attachment action to fill File content in Create file action and try again.

You can take a try with the screenshots below:

Assume my email is like below. In my test, I will rename the attachment with the content after 'Test' in the subject.

vLilyWmsft_10-1634808644365.png

Flow in details:

vLilyWmsft_1-1634807701880.png

vLilyWmsft_2-1634807730010.png

vLilyWmsft_3-1634807829502.png

Expression:trim(last(split(outputs('Compose'),'Test')))

vLilyWmsft_4-1634807842368.png

vLilyWmsft_5-1634807899984.png

Expression:last(split(outputs('Compose_2'),'.'))

vLilyWmsft_6-1634807913913.png

vLilyWmsft_7-1634808033795.png

Save and test the flow.

When I receive the email

vLilyWmsft_8-1634808075169.png

The new file will be created in Dropbox

vLilyWmsft_9-1634808210024.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

7 REPLIES 7
fchopo
Super User
Super User

Hi Alex,

Before creating the file you could add a "compose action" to define the file name. Have a look at the following example:

1) Create a compose action to build an string like "07102021_11:12"

formatDateTime(utcNow(),'ddMMyyyy_hhmm')

2) Create a compose action to append the previous string between the file name and the file extension.

concat(concat(concat(split(items('Apply_to_each')?['name'],'.')[0],outputs('Compose-GetTimeString')),'.'),split(items('Apply_to_each')?['name'],'.')[1])

3) Create the file (in this case, in OneDrive for Business).

onedrive.png

 

Hope it helps!

Ferran

 

 

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Alex_Reig
Helper III
Helper III

Hello Ferran!

 

Thank you very much 😊

 

I will try it next week

Alex_Reig
Helper III
Helper III

Hi @fchopo 

 

I tried it but it didn't work; nothing is created in the folder and when something is created is not in PDF format but in another than I can't open,

 

Best regards

Hi @Alex_Reig 

Please add Get attachment action before Create file action and use 'Content Bytes' from Get attachment action to fill File content in Create file action and try again.

You can take a try with the screenshots below:

Assume my email is like below. In my test, I will rename the attachment with the content after 'Test' in the subject.

vLilyWmsft_10-1634808644365.png

Flow in details:

vLilyWmsft_1-1634807701880.png

vLilyWmsft_2-1634807730010.png

vLilyWmsft_3-1634807829502.png

Expression:trim(last(split(outputs('Compose'),'Test')))

vLilyWmsft_4-1634807842368.png

vLilyWmsft_5-1634807899984.png

Expression:last(split(outputs('Compose_2'),'.'))

vLilyWmsft_6-1634807913913.png

vLilyWmsft_7-1634808033795.png

Save and test the flow.

When I receive the email

vLilyWmsft_8-1634808075169.png

The new file will be created in Dropbox

vLilyWmsft_9-1634808210024.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Hi @v-LilyW-msft 

 

It worked perfectly 

 

You are the best 🙂

 

PD: Do you know if there is a way to only attach de PDF file and not the JPG one?

 

Alex_Reig_0-1635241289684.png

 

Hi @Alex_Reig 

You can add Condition action to determine whether the attachment is a pdf file.

vLilyWmsft_0-1635301183395.png

Best Regards.

Hi @v-LilyW-msft 

 

It says that there is no file that accomplish that condition:

 

Alex_Reig_0-1635317393180.png

 

Maybe if I use any other  condition such as Attachment Contwnt Type it will work

 

 

Helpful resources

Announcements
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,511)