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: 
rahulll
Advisor
Advisor
The idea of this blog post is to get the body of an outlook mail in HTML format. We will enable the function which is already available in the outlook library for SAP Intelligent RPA. Currently, we can only get the mail body in text format. At the end of this blog post, we will be able to get the mail body as both a) Text and b) HTML, formats. Let's get started.




Pre-requisites: Basic knowledge of SAP Intelligent RPA

Enabling Outlook Library:

Enabling Outlook library is pretty easy in SAP Intelligent RPA, if you have already enabled the Outlook library, you can skip this step.

Assuming that you already have a project created,

  1. Head over to Scripts Tab

  2. Right Click on the left white-space

  3. From the options, choose Include library Script

  4. From the Add Library Script dialog box, scroll down and check Outlook Integration.

  5. Click Save

  6. After clicking Save, the bot may take some time to set up the library

  7. Once the bot had finished, the library can be found in the Scripts tab






Enabling getBodyHTML function:

In the outlook library, the getBodyHTML function is already available, but due to some reasons, it's commented.

So, what we will do is, we will copy the whole outlook script and we will paste that in our very own created script and then uncomment the function. In the end, we will disable the default outlook library. So let's get started.

  1. Open the outlook library

  2. Copy the whole code

  3. Right click on the white-space on Scripts area.

  4. From the options, choose Add a New Script

  5. In the New Script dialog box, Enter File Name as outlook.js and Script Name as outlook.

  6. Click Save

  7. Paste the copied code in the new script window that appears

  8. After pasting the code, search for the term getHTMLBody

  9. Uncomment the getHTMLBody function. It should look like the following.

  10. Save it

  11. Now, since our custom outlook script is done, we have to disable the default outlook library

  12. To do that, right click the default Outlook library, under Microsoft Office and click Exclude Script






Using the getHTMLBody in a workflow:

Now, we can use our uncommented getBodyHTML() just like getBody(). The following image illustrates both getBody and getBodyHTML.


We can now use both the available functions and edit the workflow. More information on outlook integration can be found here.

Link to GitHub repository here.

Cheers ?

4 Comments
Srinivas-Rao
Contributor
Hi Rahul - Excellent blog ! Thanks for sharing your knowledge.
rahulll
Advisor
Advisor
0 Kudos
🙂
This is really helpful
rahulll
Advisor
Advisor
0 Kudos
thank you so much xD