Build Your First Automation Using Outlook SDK of SAP Build Process Automation
- How to use Outlook SDK of SAP Build Process Automation to search the given email
- Subscribe to SAP Build Process Automation Using Booster in SAP BTP Free Tier
- Install and Setup the Desktop Agent
- Basic understanding of SAP Process Automation. You may review the below missions:
SAP Build Process Automation has native integration to several Microsoft Office products including Outlook and Excel SDK. In this Tutorial, you will explore how to use Outlook SDK to your automations.
- Step 1
The Outlook SDK in SAP Build Process Automation, is a collection of activities allowing you to create automations using Microsoft Outlook. It comes with a rich set of functionality. For example:
- Search an email
- Read an email
- Download attachments from an email to your local folder
- Reply to an email
- Administrative operations like move or copy email from one outlook folder to another and many more
- Step 2
To create an automation project from SAP Build Process Automation Lobby, choose Create.
Select Build an Automated Process.
You can get started with a Business Process and include automation within that.
For this tutorial, please select Task Automation option.
Project used in this tutorial is called as Outlook Sample.
Fill in the description as follows: A demo to create outlook SDK integration using SAP Build Process Automation.
Feel free to name your project and give a description as per your convenience.
Subsequently it will ask you to select your desktop agent. You can pick your active, preferably latest desktop agent version.
By the time you follow these scripts, newer Desktop agent versions may have been introduced. Install the latest version of desktop components and select the latest version of agent in this step.
A dialog box is displayed to create a new automation. You can give a name to your automation, for example
searchInOutlook. You can follow your own naming convention and name for your automation.
If you had taken the route of creating a new business process project, you can add a new automation by following the given menu options.
A new tab will open and display an empty automation for you to get started.
It adds mandatory core dependencies as part of automation addition to your project.
Once an empty project is created, you need to include Outlook SDK dependency to this project. Locate the settings wheel icon in your project.
From the dependency section, locate Outlook SDK and include it as a dependency to your project. At the time of this tutorial creation, Outlook SDK
Version 1.32.41was used.
Always update Outlook SDK to the latest version.
At this point, you are ready to work with Outlook SDK.
- Step 3
From the Tools panel on the right side, search for the activity Open Outlook Instance.
Drag and drop it into your automation flow.
Your task will be to do a simple folder search. Locate Search Email activity and add it to the flow.
Select the newly added activity and Create Custom Data as search criteria under Parameters section.
Provide a folder name and a
storeNameas per the input form. Here
storeNamerefers to the email inbox, where you wanted the SDK to search.
folderName: it is an optional input. You need to provide one if you wanted automation to search a specific outlook folder
storeName: You may have additional mailbox configured within your outlook application. This field could be handy to search specific folder in your inbox. If you wanted to search the default inbox, you can leave the
Name Value Example
Outlook sub folder name Invoices/ToCreate
Email id firstname.lastname@example.org
Review the option
SearchCriterionList. You can include additional search criteria like emails with specific subject or from specific sender. You can refer to the documentation for additional information
Add Get Emails Number (Context) activity to the flow. The previous step creates a context which is what you are going to use in the next steps.
As this is your first automation using Outlook SDK, you can do a simple check to find out if there is a result in the search. For example, you can find out how many emails are present in that outlook folder. For this, add a Log Message activity.
If you wanted, you can include a custom message using the expression editor.
Add a custom message to log the total emails in your search results.
Add Close Outlook Instance and Release Outlook Instance to your flow. This is always required with an Open Outlook Instance call to release resources used by you.
Save the project, test run the project, you should see your expected result.
Review the resources:
SearchCriterionList is one of the parameter in SearchEmail Activity. Which of the below element is not a valid element to be used as part of searchCriterionList parameter?