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

Send email based on folder name

I'm trying to create a flow that will send an email notification to a certain email distribution list when a file is saved to a specific folder in Sharepoint. For example, if a file is created in the Accounting folder an email notification goes to the Accounting department, or if a file is created in the Operations folder an email goes to the Operations department. I keep a separate Sharepoint list with the folder names in one column (Accounting, Operations, HR, etc) and the email distro in the other column (Accounting@email, Operations@email, HR@email, etc) but I'm not sure how to associate that with the flow. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Impossibru28 

Thank you for your responding.

Please take a try with the below screenshot to see if it can meet your requirements.

v-LilyW-msft_0-1621561395113.png

v-LilyW-msft_1-1621561395122.png

The three Accounting/HR/Operation folder in first-library

v-LilyW-msft_2-1621561395123.png

This is my List for storing email address.

v-LilyW-msft_3-1621561395125.png

 

When I create a file in the Operation folder

v-LilyW-msft_4-1621561395126.png

The email will be automatically sent to the mailbox of the corresponding department

v-LilyW-msft_5-1621561395128.png

When running flow, if appear checker as below, please click X, and then continue to run.

v-LilyW-msft_6-1621561395129.png

Hope the content above may help you.

Best Regards

Lily

View solution in original post

3 REPLIES 3
v-LilyW-msft
Community Support
Community Support

Hi @Impossibru28 

Thank you for posting.

According to your description you want to create a flow that will send an email a certain email distribution list when a file is saved to a specific folder in Sharepoint.

You can check whether the Folder path of the new file contains Accounting/Opreation/HR, then get the corresponding email address and send an email.

Please take a try with the following steps:

First please select the Trigger: When a file is created (properties only).

v-LilyW-msft_0-1621503215215.png

Then use condition to check whether the Folder path contains the Accounting

v-LilyW-msft_1-1621503215218.png

If Floder path contains the Accounting, Get the email address of Accounting and send an email

v-LilyW-msft_2-1621503215222.png

If No, check whether the Floder path contains the Operation.

If Folder path contains the Operation, Get the email address of Operation and send an email.

v-LilyW-msft_3-1621503215227.png

If Folder path does not contains the Operation, It means the file was created in HR folder, then get the email address of Operation and send an email as below

v-LilyW-msft_4-1621503215239.png

Then save Flow and can test it.

 

I created Accounting/HR/Operation folder in first-library

v-LilyW-msft_5-1621503215241.png

This is my List  for storing email address.

v-LilyW-msft_6-1621503215244.png

When I create a file in the Accounting folder

v-LilyW-msft_7-1621503215247.png

The email will be sent to the email address of Accounting

v-LilyW-msft_8-1621503215252.png

 

Hope the content above may help you.

Best Regards

Lily

Thanks Lily. This solution could work, but I'm worried it will get too long if the department list is very large. In my case we could have close to 100 departments, so I'm wondering if there is a more efficient way than using multiple conditions. Is there a way to set a condition if the folder name matches an item on the Sharepoint list, send the email to the address associated with that list item?

Hi @Impossibru28 

Thank you for your responding.

Please take a try with the below screenshot to see if it can meet your requirements.

v-LilyW-msft_0-1621561395113.png

v-LilyW-msft_1-1621561395122.png

The three Accounting/HR/Operation folder in first-library

v-LilyW-msft_2-1621561395123.png

This is my List for storing email address.

v-LilyW-msft_3-1621561395125.png

 

When I create a file in the Operation folder

v-LilyW-msft_4-1621561395126.png

The email will be automatically sent to the mailbox of the corresponding department

v-LilyW-msft_5-1621561395128.png

When running flow, if appear checker as below, please click X, and then continue to run.

v-LilyW-msft_6-1621561395129.png

Hope the content above may help you.

Best Regards

Lily

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,021)