cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msarfaraz
New Member

Attachment File Copy to One Drive Business when Specific Subject Meet

I am receiving the reports daily  from email address ABC@abc.com and looking the specific subject which is "Date Last Updated: 2018-04-16" the subject daily changed by date for example tommorow it will be "Date Last Updated: 2018-04-16", how i can set the flow that daily this attachement will copy in One Drive Business and replace old file.

6 REPLIES 6
vecerpa
Memorable Member
Memorable Member

Hi @msarfaraz,

 

The easiest way is to create flow that will be triggered when new email arrives to your mailbox.

 

There is option to set Subject Filter for this trigger, there can be placed something like: "Date Last Updated:".

Next step there should be condition for subject verification and this subject should contain the current date like in formula below:

 

formatDateTime(utcNow(), 'yyyy-MM-dd')

In this case utcnow() represents current day and formatdatetime() is formatting it to specific format you have in Subject.

If this this condition is met, than you should store attachment by "Create file" on OneDrive for Business. and as File content use attachment, if there is need to rename previous file, then use FileName.

 

Hope this helped you.

P.

 

 

 

 

v-xida-msft
Community Support
Community Support

Hi @msarfaraz,

 

Do you want to copy attachment files to OneDrive for Business folder based on the specific Subject of the received email?

 

I agree with @vecerpa's thought almost. I have made a test on my side and please take a try with the following workaround:

  • Add a "When a new email arrives" trigger, Has Attachment field and Include Attachments field both set to Yes.
  • Add a Condition, left input box set to Subject dynamic content of the trigger, right input box set to following formula:
concat('Date Last Updated: ', formatDateTime(utcNow(), 'yyyy-MM-dd'))

Within middle drop down, choose is equal to.

 

or you could also click "Edit in advanced mode", type the following formula:

@equals(triggerBody()?['Subject'], concat('Date Last Updated: ', formatDateTime(utcNow(), 'yyyy-MM-dd')))

 

  • Within "If/yes" branch of Condition, add a "Apply to each" action, input parameter set to Attachments dynamic content of the trigger.

         Within "Apply to each" action, add a "Create file" action of OneDrive for Business connector, specify Folder Path, File Name set to Name dynamic content of the trigger, File Content field set to Content dynamic content of the trigger.

 

Note: If the Dynamic contents would not be shown up automatically, please click the "See more" button within right Dynamic content panel.

 

Image reference:3.JPG

 

4.JPG

The flow works successfully as below:5.JPG

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

 

Best regards,

Kris

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

Hi Kris 

 

The subject line is as below

 

IDeaS Reporting - Multi-Property - Date Last Updated: 2018-04-17 : Madinah Data Extraction Program Daily

 

Daily basis the dates get change i.e. tommorow the subject line will be

 

IDeaS Reporting - Multi-Property - Date Last Updated: 2018-04-18 : Madinah Data Extraction Program Daily

and so on, so what will be the formula 

Hi @msarfaraz,

 

Within the Condition box of the flow I provided, change the formula as below:

 

Left input box set to Subject dynamic content of the trigger, Right input box set to following formula:

concat('Date Last Updated: ', formatDateTime(utcNow(), 'yyyy-MM-dd'))

Within middle drop down, choose contains.

 

Or click "Edit in advanced mode", type the following formula:

@contains(triggerBody()?['Subject'], concat('Date Last Updated: ', formatDateTime(utcNow(), 'yyyy-MM-dd')))

Image reference:11.JPG

 

12.JPG

 

 

Best regards,

kris

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

flow test.jpgflow.jpg

I dont know where am wrong, but it failed.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,245)