For each: Object reference not set to an instance of an object

Hai All, Am getting the above mentioned error to for each loop , can anyone help me in solving this issue.


Make sure mailMessages object is initialised.


I guess your Get Outlook MailMessage did not retrieve any mails here. Because of that you are getting this error.

After Get Outlook MailMessage Activity and take one message box and print the below value.


I initialized @KarthikByggari!

Hi @lakshman, I am not using Get Outlook, am using Get IMAP mail message!

Here, it is just the declaration but not initialised.

mailMessages object gets initialised when you read mails using Get Outlook/IMAP mail Messages activity.

So please make sure the mailMessages is getting initialised with Get IMAP Mail activity.


Yeah @KarthikByggari, thanks for reply.

1 Like


What ever it is just print this.


One more error @KarthikByggari, for save attachment activity am getting like this. Can you help me in this.


Can you please explain the mentioned 2nd point @KarthikByggari

open task manager and kill the uipath processes (uirobot) and try to run the project.

Now am not getting any error! after reopening the Studio @KarthikByggari.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.