How to use Outlook Components in PegaRobotics 22

How to use Outlook Components like opening outlook and sending new email with PegaRobotics 22

@SrinivasR3193Here is an Academy topic on their use, but it is pretty basic. Sending an email is covered there however. Essentially, you add the connector to your Globals and then use the NewMail method to create a new email object. You can then fill out the email properties (To, Subject, Body, etc.) and use the Send method to send it.

https://academy.pega.com/topic/microsoft-office-connectors/v2

@ThomasSasnett

I tried sending the email from pega robotics 22.1.37v, but getting COM object error message

@SrinivasR3193Do you have Outlook installed on your machine? Have you disabled StartOnProjectStart for the Outlook connector? If so, it must be started before you can send an email. Are you able to attach a screenshot of your automation(s)?

@ThomasSasnett i updated my automation to same as above and still getting the same error.

Do i need to add any references to the project like Microsoft.office.interop.outlook?

@ThomasSasnett its microsoft 365

@SrinivasR3193To show the email to the user (for them to send or edit on their own), use the Display method of the Mail object. This has a single parameter named “modal” that indicates whether or not the email message blocks anything else in Outlook. I suggest making this false unless you specifically want to force them to handle it immediately.

@ThomasSasnett

yes outlook is installed on my machine and set false to StartOnProjectStart for Outlook connector.

Due to company policy i’m not able to upload any images

@SrinivasR3193 The connector needs to be started. StartOnProjectStart should be true. You may also use the Start method on the connector to start it if it isn’t running. I suspect there is something simple you are missing. Without seeing either a log or more details, I can’t really offer many suggestions. Are you able to share the full error message you are getting? Are you certain you are setting the email properties properly? The NewEmail method returns a Mail object, so you’ll need to extract a proxy (or simply drag the blue dot from the Result data point) to access the properties and the Send methods of that object. For screenshot clarity purposes, I used a proxy, but you can also just drag out the blue dot and access the properties and Send method from there.

@SrinivasR3193 Those should be added automatically. Are you running 19.1 or 22.1? What version of Office do you have installed?

@SrinivasR3193I can’t really say what might be wrong without seeing what you’ve done. If you can’t provide any other information here (like the full error message and stack trace), you should open a support request. You can meet with support to have them take a look at your machine.

@ThomasSasnett Seems the issue with my drivers on my box. i tried the code on different box and its working.

but i have a small change in my requirement, instead of sending the email, i need to open the new email with prepopulated text in the body and show it on top of the screen, instead of me selecting the new email from taskbar.