Skip to Content

Build Your First Automation Using Outlook SDK of SAP Process Automation

In this tutorial, you will be developing a basic automation using Outlook SDK of SAP Process Automation. In the end, by using the activities in Outlook SDK, you will know 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 Process Automation to search the given email
r3kskRamakrishnan RaghuramanSeptember 22, 2022
Created by
r3ksk
August 17, 2022
Contributors
r3ksk
  • Step 1

    The Outlook SDK in SAP 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. There are two ways to create an automation project from SAP Process Automation Lobby.

      1. You can click the shortcut Create an automation
      2. You can get started with a Business Project either through Create a Process or using the Create -> Business Process and include automation within that.
      Create an automation Project
      For this tutorial, use Create an automation option.
    2. Project used in this tutorial is called as Outlook Sample. Feel free to name your project as per your convenience.

      Name your project appropriately
    3. Subsequently it will ask you to select your desktop agent, At the time time of this tutorial creation, a screenshot was taken based on Agent Version 0.24. 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. so always kindly install the latest version of desktop components and select the latest version of agent in this step.

      Link to your active desktop agent version
    4. Subsequently, a dialog box is displayed to create a new automation. You can give a name to your automation. For example, you may use 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 displays an empty automation for you to get started.

    5. As you can see, it adds mandatory core dependencies as part of automation addition to your project

      Core SDK and Excel SDK are standard core dependencies added
    6. 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
    7. 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.24.58 was used.

      Again, by the time you follow these scripts, newer versions of Outlook SDK may have been introduced. so always kindly 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

      Find Open Outlook Instance Activity

    2. Drag it onto your automation flow

      Drag Open Outlook Instance on to your automation

    3. Your task will be to do a simple folder search. So 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 optional input. You need to provide one if you wanted automation to search a specific outlook folder
      • storeName : As some of 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 GetEmailsinContext 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

    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