Get Outlook Mail Message not working

Hi, I am trying to read all the emails in Outlook, i am not able to get all the properties of the outlook mail message i.e. not able to get email body, subject etc.

hi @anuraglahoti

Please go through with this link:

hope this will help you.

Updated after @vasilisg prob

OutlookSample_v2.xaml (7.3 KB)

*if you have already configured your outlook on system then you can run it as it is.

if you have any doubt or issues then feel free to ask :slight_smile:

Regardsā€¦!!

3 Likes

Thanks Akshay.

Had a follow up question, UI path connects with my default folder.

But if I want to download email for another shared email mailbox, which gets opened up as additional mailbox in my outlook, I am getting an error. What would be best way to download the emails from the additional mailbox folder within my outlook

Hi @aksh1yadav while trying your Sample I was able to get the Subject but the Body is Empty (I am using Outlook 2013), Also when trying to get the Sender I am getting a null exception. Any suggestion? Thank you

hey @anuraglahoti

First of sorry for the late reply.
Didnā€™t noticed this. My bad :frowning:

To use another outlook email box you can pass the mail account in properties. only mention mail account name like email id when you have configured more then 1 account in outlook.

first configure the second account as well if you wants to use with outlook mail activities.

Note- If you wants to use other mail accounts like gmail etc then you can use other activities like IMAP and similarly like SMTP and POP3 according to your usage.

for gmail use IMAP activites.

Let me know the feedback on this. :slight_smile:

Regardsā€¦!!

2 Likes

hey @vasilisg

Please check this sample workflow again. i have updated regarding that sender error.

and try to change the getoutlook mail properties Top to 5 and let me know still you are not getting the mail body?

Regardsā€¦!!

1 Like

Thank you for your help,

the body is still empty and the same exception occures, for either 1 or 5 mails. Can it be a security issue? My company is really strict about security, so maybe internally the way the mailBody is aquired is not safe and hence my company doesā€™n allow it, but if this holds why am I able to get the subject?

Thank you!

@vasilisg ut for me itā€™s working and updated .xaml not getting an error as well. On my system it is working well even Iā€™m using my company outlook.

Regardsā€¦!!

1 Like

Maybe they donā€™t have default text body (guessing)ā€¦
You can check alternateViews and see if you can get one of them.

Hi @vasilisg,

We are also facing same issue as like you.
So, have you get any solution ,if yes can you please give me .xaml file or solution.

Thanks,
Sandy

thanks, I tried to run the process, yet, it throw an exception saying that ā€œspecified folder does not existā€. may I know if I should first configured in outlook account, so that UiPath can read my Outlook account?? If configuration is required, may I know how to configure it in UiPath?? thanks~

You have already setup Two outlook account on your system?

Regardsā€¦!!

1 Like

I can ā€œget outlook mailā€ at the moment, but for ā€œsend outlook mailā€, it throws to exception, saying that
ā€œOperation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))ā€

may I know if I it is blocked by firewall?? and must be solved by companyā€™s security team? any way from UiPath can help to solve this issue? thanks~

Yes michal try to open your outlook and then try to run it will work :slight_smile:

Regardsā€¦!!
Aksh

1 Like

thanks, I have tried to close and re-open Outlook, but same exception box pop upā€¦

yes to make it work just remain open outlook for now. will soon get back to you :slight_smile:

Regardsā€¦!!
Aksh

1 Like

Hi All

I am getting below exception

Exception from HRESULT: 0x80004004 (E_ABORT)) while sending the mail using outlook send activity.

Any pointers ???

Please let me know

Hey @Todd

According to a few of the Microsoft sites (e.g. Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) - outlook appointment ) this is due to ā€˜object model guardā€™. A security feature to prevent automated programs from doing stuff like auto-emailing out viruses and stuff from the background.

Not sureā€¦ but if Outlook is installed and it is not open while running workflow then this might be a problem

1 Like

I face the same issue, and does not matter if the Outlook client is running or not. I am able to retrieve a message using the Outlook activity, I get a message collection of 1 item and then iterating through the collection, I can read the subject line with no issue (writing out to the log - in this case ā€œHillary + Robotā€) - however as soon as I attempt to read the From property, I get an error message. In addition to reading the subject, the finally block moves the message to a different folder, so I know that the Mail item is properly instantiated - but something (presumably the object model guard) is blocking access to the From property.

System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at Microsoft.Office.Interop.Outlook._MailItem.get_HTMLBody()
at UiPath.Mail.Outlook.Activities.Outlook.CreateMailMessageFromOutlookMailItem(MailItem mi, Boolean saveattachments, String folderpath)
System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at Microsoft.Office.Interop.Outlook._MailItem.get_Body()
at UiPath.Mail.Outlook.Activities.Outlook.CreateMailMessageFromOutlookMailItem(MailItem mi, Boolean saveattachments, String folderpath)
> Retrieved 1
> Subject: Hillary + Robotics
Error handling email: System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method(Closure , ActivityContext )
at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
> DEMO execution ended in: 00:00:01

Initially, the IT team identified that my Antivirus was listed as invalid, and resolved that issue - however the problem persists.

Is there a profile or client setting which can solve this problem? Has anyone who has faced this problem been able to resolve it?

When I tried to run the OutlookSample_V2 I got the same warning (whether Outlook was open or not):

System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at Microsoft.Office.Interop.Outlook._MailItem.get_HTMLBody()
at UiPath.Mail.Outlook.Activities.Outlook.CreateMailMessageFromOutlookMailItem(MailItem mi, Boolean saveattachments, String folderpath)
System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at Microsoft.Office.Interop.Outlook._MailItem.get_Body()
at UiPath.Mail.Outlook.Activities.Outlook.CreateMailMessageFromOutlookMailItem(MailItem mi, Boolean saveattachments, String folderpath)
Outlook top 1st mail messages subjects==============================
RE: Approval required: Multiple orders for Sathish Srinivasalu

Write line : Object reference not set to an instance of an object.
DEMO execution ended in: 00:00:01

Hi I had the same issue.

I had this to begin with, which gave me the ā€œCOMExceptionā€ error:

StringTopLevelFolder: ā€œ\Inbox\Robotā€

StringNextLevelFolder: ā€œ\Inbox\Robot\Archiveā€

I changed my StringNextLevelFolder path to ā€œ\Robot\Archiveā€

It somehow did the trick.