SHIFT

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

User Tools

Site Tools


flowemailtosharepointlist
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

flowemailtosharepointlist [2019/04/02 16:15] (current)
sjoerd created
Line 1: Line 1:
 += 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. 
 +
 +<​code>​
 +Domainname: website.nl
 +email: info@website.nl
 +phone: +31612345678
 +request: I'd like to change the color of the main page to purple
 +</​code>​
 +
 +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 [[https://​docs.microsoft.com/​en-us/​azure/​logic-apps/​workflow-definition-language-functions-reference|here]] more about the functions. ​
 +
 +{{tag>​o365 cloud}}
flowemailtosharepointlist.txt ยท Last modified: 2019/04/02 16:15 by sjoerd