We want our SQL database to send an email with a table of countries to a library. The workflow needs to run when the email arrives and reference only the table contents in the email body. Then the workflow will parse apart the table rows and populate a list with the data. I know how to do that part, I've developed this kind of workflow before, but we've always started with a .csv file.
What I can't figure out (because I'm still fairly new at HTML) is how to get the workflow to read the email. I found one thread that addresses this specific issue, but it's been dormant for a while and no solid solution given. The respondent suggested they use the Query XML action, save the contents to a "Multi String variable", and then use a Regular Expression to parse the information.
Not knowing what to do first, I thought I would start by viewing the source of one of the emails that was forwarded to me. I copied the HTML and pasted it into the Query XML action and clicked on the XPath builder tree view to see what I could see. I got an error message when I clicked on tree view that said "Error parsing xml: A string literal was expected, but no opening quote character was found." So then I played around with the HTML, but no luck. I really don't know what I'm doing.
I want my workflow to take an email, find the start of the table, and start parsing the data from there. How do I do that?
When I manually enter neat HTML, like this:
and process using this:
I get this:
Very nice. This is exactly what I want. The problem is that my incoming email creates a lot of extra code before the table starts and the workflow can't parse the table apart. I know I can replace patterns with a Regular Expression, but there is a LOT of code. Surely this is possible and someone out there has done this before.
UPDATE: According to Vadim Tabakman, the email has been bae64 encoded and the workflow has no way of parsing that data. He thinks it may be possible with some code. I will update again when I have more information.