Highlighted
Valued Contributor.
Valued Contributor.
249 views

Verify a 'table' and its contents in the body of an outlook email message

Jump to solution

I have a table inserted in one the email body (MS Outlook 365). The email message has a certain fixed pattern as below. Is there some way i can verify this table and its contents?( column headers/total etc)

objOutlook. Body - this yields the entire body content as a string.

(Note : Without copying the data to excel file or notepad)

Hi,

Abc is launching a product with following catalog.

  1st2nd3rd4th
a 7000 800 
b  9000 1200
c    1000
d 4000   
e 3009000  
Total 11300180008002200

 

Thanks,

XYZ Team

 

Labels (3)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Are there an embedded browser in your wpf application? If so, you don't have to return the string to check. You may able to check the html right inside the wpf application.

`

Please find the relevant content below for CEF and IE.

https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/Addins_Guide/Work_with_CEF_Applications.htm

https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/Addins_Guide/Register_Browser_Control_Tool.htm

 

If this is not the case, you don't have such an embedded browser. I think you'll have to do some coding to parse the html string. You may also develop your .net application to get all the info from the string and load the assembly by DotNetFactory.CreateInstance, which should easier than writing such complicated code inside vbscript. https://html-agility-pack.net/ or google similar solutions for html parse.

View solution in original post

8 Replies
Highlighted
Valued Contributor.
Valued Contributor.
*a table inserted in the email
0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

@Jerry2  - can you help on this one too? or tag someone who might have a good shot at outlook automation.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi,

Some general idea about this.

So you are trying to find the table inside the message body, right? Please paste your message body here.

I think the message body is a html. In this case you may try to parse the html and get the table by xpath.

 

Thanks

Jerry

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Yes I am trying to verify the table inside the mail body. (table- header/contents/format). So in the below case I need to verify columns 1st,2nd,3rd(whatever the headers are), the values in each column and then total at the end.

also verify the signature.

Below is the email content :

Hi,

Abc is launching a product with following catalog.

  1st2nd3rd4th
a 7000 800 
b  9000 1200
c    1000
d 4000   
e 3009000  
Total 11300180008002200

 

Thanks,

XYZ Team

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi,

I'm trying to understand the content you want to check is a string, or a table on the website?

1. If the mail content you want to check is on the website, since you mentioned outlook 365, you may try to add a checkpoint on the table. Please review the link below for how to add a checkpoint.

https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/User_Guide/Task_Add_Checkpoints_Print.htm

2. If it's just a string from message.body, you need to find the interested content by pattern.  in this case, I need to check the string, original string, you may put then inside an attachment and upload.

So which case is your question?

 

Thanks

Jerry

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

It is a "table" in form a string in the message body.  I cannot attach the real data due to privacy concerns.  

So the scenario is : 

My .net wpf application on the click of the button, initiates an email which has a table inserted in it. 

if i use this code msgbox(oEmail.Body) = this returns the entire content as a string.

if i use  msgbox(oEmail.HTMLBody) = this will return the HTML codes and values. 

 

 

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.
I think the message body is a html. In this case you may try to parse the html and get the table by xpath- any useful links on this?
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Are there an embedded browser in your wpf application? If so, you don't have to return the string to check. You may able to check the html right inside the wpf application.

`

Please find the relevant content below for CEF and IE.

https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/Addins_Guide/Work_with_CEF_Applications.htm

https://admhelp.microfocus.com/uft/en/15.0-15.0.1/UFT_Help/Content/Addins_Guide/Register_Browser_Control_Tool.htm

 

If this is not the case, you don't have such an embedded browser. I think you'll have to do some coding to parse the html string. You may also develop your .net application to get all the info from the string and load the assembly by DotNetFactory.CreateInstance, which should easier than writing such complicated code inside vbscript. https://html-agility-pack.net/ or google similar solutions for html parse.

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.