cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Outlook Profiles using Outlook VBO

Venkata_Pranav_
Level 6
Will there be any support on reading emails from multiple Outlook profiles using the latest Outlook VBO. As of now, Outlook VBO could only read the default Outlook profile. 
Pranav
52 REPLIES 52

Hi Ami,
Thank you.
I'm not getting any warning from outlook related programatic access.
Should I select "Never warn option" in programatic access?
Please guide me in control what should be choosen?
1.prompt for profile or 2.Always use defualt profile?

------------------------------
Sindura Eaga

------------------------------

Indeed, never warn is always recommended for programmatic access when using the Outlook Interop libraries (which the Outlook VBOs use).

In previous setups where I had this working, I didn't change the profile prompt settings, so it was still set to prompt on start. (This prompt never showed when using the VBO.) If it still does, you can always try the option for using a default profile, see how it behaves, then switch back if necessary.

------------------------------
Ami Barrett
Automation Developer, Team Lead
Blue Prism
Plano, TX
------------------------------

Hi Ami,
Thank you.
every action we are creating outlook object Dim app = CreateObject("Outlook.Application").
CreateObject("Outlook.Application") in global code and in action Marshal.getactiveobject( outlook.application ) giving the below error in Outlook VBO.
System.Runtime.InteropServices.COMException (0x800401E3);
similar to handle in excel VBO.





------------------------------
Sindura Eaga

------------------------------

The reason for this is so you can easily switch between profiles if need be. While that particular feature isn't in the official Outlook VBO supplied by Blue Prism, it's more of a holdover from when we were supplying the MAPIEx library. Likewise, that it has been left this way made the VBO easy enough to extend to add this functionality back in.

------------------------------
Ami Barrett
Automation Developer, Team Lead
Blue Prism
Plano, TX
------------------------------

Hi Ami,
Thank you.

------------------------------
Sindura Eaga

------------------------------

I'm a little confused on the ask here. The only way a process and object can interact with each other is to drag an action stage into the Process Studio.

If the concern is in the act of calling CreateObject("Outlook.Application"), that would need to be taken out of each action and placed into the global code of the object.

------------------------------
Ami Barrett
Automation Developer, Team Lead
Blue Prism
Plano, TX
------------------------------

Hi Ame,
Thank you.




------------------------------
Sindura Eaga
----------------

Looks like you edited your series of posts and changed the question here. Where previously it was pertaining to how to move the CreateObject line, it now seems to be about calling getactiveobject. Two things jump out at me here.

First, the Excel/Word VBOs use these methods as a result of trying to maintain persistent sessions. Inversely, each action within the Outlook VBO is a self-contained session handle to the application. The programmatic bridge is smart enough to not have multiple instances as a result of calling multiple actions. This method of interacting with the application should be unnecessary, and you are likely better off reverting to how the VBO was shipped. (Unless you want to try another VBO that uses other methods, such as EWS or SMTP.)

Second, what I'm finding about that error code (0x800401E3) seems to be related to an elevated permissions issue. It's likely that Outlook is running from an elevated account, while Blue Prism is not. I would recommend watching the Details tab in Task Manager to see which accounts are being used for Outlook and Blue Prism. Likewise, try testing it where Outlook is closed prior to running the actions, and then again where Outlook is already open and see if the same error occurs both times, or if it behaves any differently.

------------------------------
Ami Barrett
Automation Developer, Team Lead
Blue Prism
Plano, TX
------------------------------

Hi Ami,
Thank you.

Outlook VBO, giving error "cannot create activex component" when outlook open.
After outlook closes it is working fine.
Same code in Visual studio working fine when Outlook open or close.
Please let me know what need to done and what is issue.

------------------------------
Sindura Eaga

------------------------------

Since you said it's specifically when Outlook is running, it sounds like something's preventing multiple instances. Try making the following modifications:

Code Options -> External References:
-Add: System.Diagnostics.Process.dll

Code Options -> Namespace Imports:
-Add: System.Diagnostics

Internal_GetItems code stage:
-Replace the line for "Dim app = CreateObject("Outlook.Application")" with the following code (Screenshot of implementation also attached)
6669.png

Dim OutlookInstance As Integer = Process.GetProcessesByName("Outlook").GetLength(0)
Dim app as Object

If OutlookInstance >0 Then
	app = GetObject(,"Outlook.Application")
Else
	app = CreateObject("Outlook.Application")
End If​


------------------------------
Ami Barrett
Automation Developer, Team Lead
Blue Prism
Plano, TX
------------------------------