SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

flowemailtosharepointlist

Use Flow to Parse Email Body to SharePoint Online List Items

This is one of the more complex things you might want to do with flow. It takes a lot of work, and it is very imported the email you want to parse has a structure so you can put some logic into it.

The Email

This is the format of the email we want to process. Note that all kinds of fields are possible as long as it the same format and matches the field input in the SharePoint list.

Domainname: website.nl
email: info@website.nl
phone: +31612345678
request: I'd like to change the color of the main page to purple

As you see we have 4 datafields, Domainname, email, phone and request.

Before we Start

Please notice these things:

  • Keep the case in mind. I've had trouble with flow when I accidentily changed UpperCase to LowerCase and vice versa.
  • We process the data by determining the start of the data, and the start of the next datafield. Then we'll get the data in between. This means we'll need three compose actions per datafield
  • The last datafield does not have a next datafield, so for the last datafield we'll use the length of the body to determine the end of the datafield

The Flow

This is an overview of the flow. As you can see it's quite long:
flowemailtosharepointlist01.jpg
The details of “Html to text” and the first Compose Action. It is very important to rename all of your compose actions to keep track of them. See the details below for the exact expression:
flowemailtosharepointlist02.jpg
The details of the Create Item action:
flowemailtosharepointlist03.jpg

Note that also in the ComposeGetDomainname the warning “We can't find any output to match this input format” is displayed. After you click “See more” you'll have the option to select “Output”

Details

  • Compose Action (rename after creation):
    • ComposeStartDomainname: add(indexOf(Body('Html_to_text'),'Domainname'),12)
    • ComposeEndDomainname: indexOf(body('Html_to_text'),'email')
    • ComposeGetDomainname: substring(body('Html_to_text'),outputs('ComposeStartDomainname'),sub(outputs('ComposeEndDomainname'),outputs('ComposeStartDomainname')))

Use these for the last datafield (request in my case):

  • Compose Action (rename after creation):
    • ComposeStartRequest: add(indexOf(Body('Html_to_text'),'request'),9)
    • ComposeLength: length(body('Html_to_text'))
    • ComposeGetRequest: substring(body('Html_to_text'),outputs('ComposeStartRequest'),sub(outputs('ComposeLength'),outputs('ComposeStartRequest')))

Functions

The expressions use the following functions:

  • sub: Return the result from subtracting the second number from the first number.
  • indexOf: Return the starting position for a substring.
  • substring: Return characters from a string, starting from the specified position.
  • add: Return the result from adding two numbers.

You can read here more about the functions.

You could leave a comment if you were logged in.
flowemailtosharepointlist.txt · Last modified: 2021/09/24 00:24 (external edit)