Validate Outlook mail

Ask general questions here.
Joergli77
Posts: 2
Joined: Thu Mar 01, 2018 8:17 am

Validate Outlook mail

Post by Joergli77 » Thu Mar 01, 2018 9:31 am

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

User avatar
RobinHood42
Posts: 240
Joined: Fri Jan 09, 2015 3:24 pm

Re: Validate Outlook mail

Post by RobinHood42 » Fri Mar 02, 2018 3:09 pm

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Validate Outlook mail

Post by odklizec » Fri Mar 02, 2018 3:23 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Joergli77
Posts: 2
Joined: Thu Mar 01, 2018 8:17 am

Re: Validate Outlook mail

Post by Joergli77 » Mon Mar 05, 2018 11:53 am

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.

Peadar_H
Posts: 18
Joined: Tue Jun 02, 2015 8:48 pm

Re: Validate Outlook mail

Post by Peadar_H » Mon Mar 05, 2018 9:42 pm

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.