Page 1 of 1

Validate Outlook mail

Posted: Thu Mar 01, 2018 9:31 am
by Joergli77
Hi,

i am new to Ranorex. I am using Outlook 2016 and want to check if there exists an E-Mail with a specific subject in the Inbox Folder with user Code.
My idea was to pass the Inbox Grid Item of Outlook (which i can see with Ranorex Spy) and the subject of the E-Mail to a user Code Function.
The function should then iterate through the Items of the Inbox Grid Item and search the E-Mail with the subject.
If found, i want to Access the text of the Mail Body and maybe the Attachements if possible.

Has someone done this already and can help me out with some Code snippets oder just ideas how i can achieve this ?

Thanks,

Jörg

Re: Validate Outlook mail

Posted: Fri Mar 02, 2018 3:09 pm
by RobinHood42
Hey,

Why do you want to iterate through the different items? You can do that without writing any code just by using a smart rx path.

For example:
/form[@title~'^TitleOfYourOutlookWindow']//container[@name~'^Group']//text[@classname='SubjectField' and @name~'Subject of the searched email']

Cheers,
Robin

Re: Validate Outlook mail

Posted: Fri Mar 02, 2018 3:23 pm
by odklizec
Hi,

In my opinion, neither approach will work very well. If the email in question will be buried somewhere outside the visible area, it will not be found. As far as I know, emails outside the visible area are not loaded in memory and therefore, it would be impossible to find them without scrolling. I think the best approach would be to use Outlook search facility, to find the given email.

Re: Validate Outlook mail

Posted: Mon Mar 05, 2018 11:53 am
by Joergli77
Thanks for helping. In my case different E-Mails with different subjects are created from our application and i want to check if they all were created correctly. So you are right. The best way is to use Outlook search functionality to locate one Email and then validate the Content. And the the other mails in the same way.

Re: Validate Outlook mail

Posted: Mon Mar 05, 2018 9:42 pm
by Peadar_H
In case it helps: we had to view and retrieve a uniquely generated security code (for AUT user authentication purposes) delivered in an Outlook email. It was easier to set up an Outlook rule to filter inbound emails containing the security codes and route them to a dedicated email folder. Then Ranorex would go to that Outlook folder and would rarely have to deal with the 'noise' of other incoming emails. Helpful users on the forum provided regex syntax that would pull out the unique security code and assign it to a variable to populate for the app/user session in the recording module.

Also I believe I had to first use the GDI feature here to allow Ranorex to see/access the body of the email:

https://www.ranorex.com/help/latest/tec ... plications

Not sure this will help your situation but thought I would pass on in case.