Skip to Content

Build Your First Automation Using Outlook SDK of SAP Build Process Automation

In this tutorial, you will be developing a basic automation using Outlook SDK of SAP Build Process Automation. In the end, by using the activities in Outlook SDK, you will learn how to search outlook inbox or a specific email folder and download any attachments found in the email to a specific local folder.
You will learn
  • How to use Outlook SDK of SAP Build Process Automation to search the given email
Created by
celineaudinsap
November 20, 2022
Contributors
celineaudinsap

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
    1. To create an automation project from SAP Build lobby, choose Create.

      Create an automation Project
    2. Select Build an Automated Process.

      Build an Automated Process
    3. You can get started with a Business Process and include automation within that.

      For this tutorial, please select Task Automation option.

      Task Automation
    4. In the Create a Task Automation project window, name the project: Outlook Sample.

    5. 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.

      Name your project appropriately
    6. 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.

      Link to your active desktop agent version
    7. 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.

      Add an automation to your project

      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.

      Add a new automation to case of business process project

      A new tab will open and display an empty automation for you to get started.

    8. It adds mandatory core dependencies as part of automation addition to your project.

      Core SDK and Excel SDK are standard core dependencies added
    9. Once an empty project is created, you need to include Outlook SDK dependency to this project. Locate the settings wheel icon in your project.

      Locate the settings Icon in your projects
    10. 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.41 was used.

      Always update Outlook SDK to the latest version.

      Add Outlook SDK to your project

      At this point, you are ready to work with Outlook SDK.

  • Step 3
    1. From the Tools panel on the right side, search for the activity Open Outlook Instance.

    2. Drag and drop it into your automation flow.

      Drag Open Outlook Instance on to your automation
    3. Your task will be to do a simple folder search. Locate Search Email activity and add it to the flow.

      Add Search Email Activity to the automation
    4. Select the newly added activity and Create Custom Data as search criteria under Parameters section.

      Add a custom search criteria
    5. Provide a folder name and a storeName as per the input form. Here storeName refers 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 storeName empty.
      Name Value Example
      folderName Outlook sub folder name Invoices/ToCreate
      storeName Email id mymail@bestrunsap.com
      Give your search criteria

      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

    6. 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.

      Add Get Email In Context Activity
    7. 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.

      Add Log Message
    8. If you wanted, you can include a custom message using the expression editor.

      Open Expression Editor
    9. Add a custom message to log the total emails in your search results.

      Add A Custom Log Message
    10. 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.

      Close and Release Outlook Instance
    11. Save the project, test run the project, you should see your expected result.

      Test & Validate 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?

Back to top