cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bigshow
Helper II
Helper II

Forwarding email based on keyword stored in Sharepoint list

Hi All

 

I have a SharePoint list that contains two columns

 

Keyword, UserEmail

 

When a new email arrives into a shared mailbox, i would like to have the email body searched for any of the keywords found. If there is a match then the email is forwarded (as an attachment) to the associated user email.

 

Is this possible? Does anyone know how to achieve this?

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Community Champion
Community Champion

Hi @Bigshow 

 

This worked for me:

DamoBird365_0-1617171981523.png

 

When I run this on my newly received email it contained one of the words.  The apply to each looped 3 times and once branched down the yes.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

View solution in original post

8 REPLIES 8
DamoBird365
Community Champion
Community Champion

Hi @Bigshow 

 

I have just built a wee proof of concept on the assumption the subject must match 100%.

 

You can filter in the get items action and if a result is returned i.e. length of result is greater than 0, send an email.

 

List:

 

DamoBird365_0-1617133344714.png

 

Flow:

 

DamoBird365_1-1617133370089.png

 

Just realised the screenshot misses out the filter... here it is:

DamoBird365_0-1617133531806.png

 

 

Hope that is visible and works for you?

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

 

Thanks but I don’t think I explained myself quite right.

 

so when a new email arrives I would like the body of it scanned for any of the keywords contained in the Sharepoint list. If there is a match then I would like the email forwarded (as an attachment) to the email address associated with the matching keyword

 

 

DamoBird365
Community Champion
Community Champion

Hi @Bigshow 

 

Late night last night and I see I didn't read it right, apologies.  You could achieve this in a similar way using an apply to each on all of the returned rows from get items.  No need for a filter.

 

Within the apply to each you can use indexof expression on each of the key words on the body and then if a number is returned, you know the word exists in the body.  Otherwise - it doesn't.

 

Hope that makes sense.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Bigshow
Helper II
Helper II

Thank you 

 

would it be possible to produce a sample workflow?

DamoBird365
Community Champion
Community Champion

Hi @Bigshow 

 

This worked for me:

DamoBird365_0-1617171981523.png

 

When I run this on my newly received email it contained one of the words.  The apply to each looped 3 times and once branched down the yes.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

View solution in original post

Thanks

 

I have tried to copy these steps, but im having problems with the Indexof(). The dynamic's are not appearing for me to place in the indexof() expression. I cant see what im doing wrong

 

 

Bigshow_0-1617178534630.png

 

DamoBird365
Community Champion
Community Champion

Hi @Bigshow 

 

It won't.  You will need to build it up.

 

Here is a copy of mine 

indexOf(triggerOutputs()?['body/body'],items('Apply_to_each')?['Subject'])
Make sure you update Subject with the name of your column.
 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here

Thank you

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (43,567)