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

Using the file path to build an email address

Hello,

 

I tried this previously and it wouldn't work due to how the filesystem triggers worked,  but it seems to be possible now. 

I have a personnel folder that contins folders for individuals, so they look like, /Shared Documents/Personnel/First Last/

Inside there there are other folders like HR, Forms, Docs, etc.  I've already got it watching /Shared Documets/Personnel, so if anyone creates or modifies a file in one of the employee sub-folders, it will email the file to a test email address I have.  What I'd like to do is have the email recepient address be filled in based on the file path (our email scheme is first.last@company.com).  So as an example, if someone drops a file into /Shared Documents/Personnel/John Doe/Documents/file.txt, it will use the file path to create john.doe@company.com and put that into the To field.  Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Using the file path to build an email address

 

Hi @sdgewand ,

 

Could you tell us which connector you are using? File System or SharePoint Library?

I used SharePoint Library to illustrate how to get the username contained in the File path.

Use the Split() function to split the File path with "Personnel/" and "/Documents" as the split points, and then get the First last name contained in the File path.

Then combine them into the email address.

Expression reference:

concat(toLower(replace(first(split(last(split(body('Get_file_metadata')?['Path'],'Personnel/')),'/Documents')),' ','.')),'@company.com')

Image reference:

178.PNG

 

Best Regards,

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

View solution in original post

3 REPLIES 3
Highlighted
Super User II
Super User II

Re: Using the file path to build an email address

@sdgewand 

Hi there.  Seems like this is totally possible, what do you have so far?  I think an O365 Get User Profile won't work since you'll need the email address ahead of time, but you might be able to use the Office 365 Users connector action, "Search Users" and use the file path section as the search term.

 

Keep us posted.

-Ed-

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Highlighted
Community Support
Community Support

Re: Using the file path to build an email address

 

Hi @sdgewand ,

 

Could you tell us which connector you are using? File System or SharePoint Library?

I used SharePoint Library to illustrate how to get the username contained in the File path.

Use the Split() function to split the File path with "Personnel/" and "/Documents" as the split points, and then get the First last name contained in the File path.

Then combine them into the email address.

Expression reference:

concat(toLower(replace(first(split(last(split(body('Get_file_metadata')?['Path'],'Personnel/')),'/Documents')),' ','.')),'@company.com')

Image reference:

178.PNG

 

Best Regards,

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

View solution in original post

Highlighted
Regular Visitor

Re: Using the file path to build an email address

Thank you!  That worked great.  The only modification I did was that, rather than 'Documents/' I just used '/' to split it, otherwise it included all the sub-folders following the name. 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (9,793)