Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
One of the most common use cases while creating a bot is to notify a person about the results or logs of the operation executed using a bot.

SAP Intelligent Robotic Process Automation provides easy integration with Microsoft Outlook.

Note: The pre-requisite step is to include the Outlook library script.

Right-click on the Scripts pane and click on the "Include library Script" option.


In the corresponding Add Library Script Popup, check "Outlook Integration" option.


Now, let us see a step by step procedure to create a mail.

 

Step 1: Initialize the Outlook application.

             ctx.outlook.init();

Step 2: Create the mail with the recipient mail address including subject and mail body.

            ctx.outlook.mail.create( {

                              To: <Recipient Mail Address>,

                              Subject: <Mail Subject>,

                              Body: <Mail Body>

               });

The body is of type string.

You could set the appropriate mail body format using the following snippet.  By default, it is of HTML format.

             ctx.outlook.mail.setBodyFormat(0, 1);

where the second parameter "1" represents a plain body format. The various options available are

0 (unspecified), 1 (plain), 2 (HTML), 3 (rich text)

Step 3: You could set the importance of the mail using the following snippet.

            ctx.outlook.mail.setImportance(0, 2);

where the second parameter "2" represents a mail of high importance. The various options available are

1 (default), 2 (high), 0 (low)

In case, an acknowledgment on receipt of the mail is required, use the following snippet.

            ctx.outlook.mail.setAskAR(0);

Step 4: You could include attachments to the mail using the following snippet.

            ctx.outlook.mail.attach(0, <File Location>);

If multiple attachments are to be attached, then provide the file locations in an array as follows,

            ctx.outlook.mail.attach(0, [<File 1 Location>, <File 2 Location>, <File 3 Location>]);

Step 5: Final step? No. This is the pre-final step. Send the mail.

            ctx.outlook.mail.send(0);

In all the above snippets, the first parameter "0" represents the mail index of the working mail collection.

Step 6: Final and important step. It is necessary that an initialized Outlook application is ended properly using the following snippet.

            ctx.outlook.end();

For more information, refer to the wiki.

That's it, folks. 🙂
14 Comments