Hello,
Is there a way to leverage a flow to pull out email body and subject details without using a third party service? I'm looking to move details from an email into a sharepoint list.
Thank you
Solved! Go to Solution.
Hi @Willo,
Yes, it could be achieved by using WDL function in flow.
Say your email body would be always the following format:
Then you could create a flow likes below. In this case, I will show how to extract the subject from the email body, please take it for a reference.
The flow is triggered by When a new email arrives, then convert the email body from Html to text.
In action Compose, use the code to get the total length of the body:
length(body('Html_to_text'))
In Compose2, use the following code:
add(indexOf(body('Html_to_text'),'Subject'),9)
In compose3, use the following code:
indexOf(body('Html_to_text'),'Start time')
In Compose4, use the following code:
substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose_3'),outputs('Compose_2')))
It works fine and the subject can be extracted from the email body successfully.
More details about the functions at here:
https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference
Best regards,
Mabel Mao
Hi @Willo,
Yes, it could be achieved by using WDL function in flow.
Say your email body would be always the following format:
Then you could create a flow likes below. In this case, I will show how to extract the subject from the email body, please take it for a reference.
The flow is triggered by When a new email arrives, then convert the email body from Html to text.
In action Compose, use the code to get the total length of the body:
length(body('Html_to_text'))
In Compose2, use the following code:
add(indexOf(body('Html_to_text'),'Subject'),9)
In compose3, use the following code:
indexOf(body('Html_to_text'),'Start time')
In Compose4, use the following code:
substring(body('Html_to_text'),outputs('Compose_2'),sub(outputs('Compose_3'),outputs('Compose_2')))
It works fine and the subject can be extracted from the email body successfully.
More details about the functions at here:
https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference
Best regards,
Mabel Mao
Hello, @Willo!
Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!
Thank you for being an active member of the Flow Community!
-Gabriel
Flow Community Manager
Could you explain how you then create the list itemfrom the extracted text items? This was the OP's original aim, and we have a similar problem.
Regards
I was able to do this by making sure I had a connection for SharePoint online in my connectors.
Then I selected after "compose 4", Create Item for SharePoint, then by putting in the address of the site in SharePoint online, then selecting the list,
Then used the dynamic content selector to get the output for Compose 4
Hi @v-yamao-msft ,
I know this is quite an old post but i hope you will be able to help. Could you explain each of the various compose steps? I'm especially curios why you have a 9 in compose 2?
Seeing this is quite old is there any new and better ways to do this without a third party services of course.
Hi @dee2005
@dee2005 wrote:Hi @v-yamao-msft ,
I know this is quite an old post but i hope you will be able to help. Could you explain each of the various compose steps? I'm especially curios why you have a 9 in compose 2?
Seeing this is quite old is there any new and better ways to do this without a third party services of course.
I supposed that @v-yamao-msft ha used 9 because if you see, you have "Subject" plus ":" plus " " (blank space), so the total characters are 9.
--
Regards
Marco
@v-yamao-msft So the problem I am facing is : I am getting an email , in email 's body i am getting an email address" , I need to extract that . Can you suggest something?
and by using the "TRIM" expression, this even works when using a table within the html-email-message!
you would need to identify the start and the end of your email address. maybe seach for the "@" and the nearest "space" before and after this string?
User | Count |
---|---|
33 | |
15 | |
14 | |
13 | |
9 |
User | Count |
---|---|
39 | |
31 | |
25 | |
14 | |
12 |