Skip to Content
Personal Insights
Author's profile photo Hariom Yadav

Automate Email Attachment Extraction Using SAP Build Process Automation

SAP Build Process Automation is a solution designed to help you automate business processes without writing any code. It’s a part of the SAP Business Technology Platform and combines the capabilities of SAP Workflow Management and SAP Intelligent Robotic Process Automation.

With the help of SAP Build Process Automation, integration of outlook with the tool is seamless.

Submission of documents is an important step in any business process whether it’s an approval system or just compilation of important documents that are received in mailbox. To avoid manual effort and scope of error. Best way is to automate the process using the above tool.

In this Blog, we will create an automation to extract attachments from outlook mailbox and save it to local desktop.


  • Subscription of SAP Build Suite Standard Edition.
  • SAP Desktop Agent should be configured in the system
  • Browser extension “SAP Build Process Automation”
  • Outlook App

Follow the steps as given below:-

1.  Click on “Create” to build a new project.



2.  Select “Build an Automated Process”.



3.  Select “Task Automation” to create an automation.



4.  Name the project. In this case, we are going with ‘Email Extraction’ and description ‘Automation for email attachment extraction’.



5.  Select the version for SAP Desktop Agent that you have installed in your system. It will show ‘local’ and ‘registered’ in the option. And confirm.



6.  Create an Automation



7.  Add Dependencies from the setting beside release button on the top.
Add Business process project dependency-
Outlook SDK



8.  This is an empty canvas for your automation



9.  Search for “Open Outlook Instance” in the Tools section and drag it to the canvas to connect



10.  Add “Search Email (Outlook)” from the tools section.



11.  Add Input parameters in left pane.
Create a custom data




12.  Click on “+” search criteria list.



13.  There are various categories to select from



14.  In this case, we will chose “subject” in element an enter details as below:



15.  Add “Forever Loop” from tools section.



16.  Add “Check current Email” from tools section and place as shown below.



17.  Enter condition “isContextCurrentEmailExist”.


18.  Add “Save All Mail Attachments (Outlook)”



19.  Define path for the folder you want to save in your local desktop.



20.  Add “Release Outlook Instance” to close the Outlook, which was opened.



21.  We will be extracting this mail attachment and save it to our desktop.



22.  Testing the automation
Click on the Test button to run the automation.



23.  Click on “Test”.
(Note: Make sure your SAP desktop Agent is working and is in ‘attended mode’)



24.  You can see automation ran successfully without any error.


25.  Checking the file in desktop

Since, the automation ran successfully, you could see the file had been extracted from Outlook.


We have seen how we can create an email attachment extracting automation using SAP Build Process Automation with no-code capability.

Please do share your thoughts about this automation in the comments..

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Gaurav Sharma
      Gaurav Sharma

      Very nicely explained.

      Author's profile photo Daniel Wroblewski
      Daniel Wroblewski

      Wonderful blog ... really helpful!!

      Can you explain a few more things?

      • How do we exit Forever loop?
      • Does the search activity return a list of matched emails?
      • What does "Check Current Email" do?
      • How does the condition work with isCurrentContextExist?



      Author's profile photo Ramakrishna Reddy
      Ramakrishna Reddy



      How it works simplified?

      1. Search Email Activity : It will return a list of emails which matches the given criteria(If we search anything on the outlook, we will get matched results).
      2. Check current email: After search email activity, we will get all the matched results, we will check whether there is email with matched criteria or not using Check Current Email activity. It will return boolean value isCurrentContextExist(true for email exists).
      3. Condition: If email existed, it will save the attachments to the specified folder and ends the loop if there is no email existed using Loop end activity.

      Currently, the blog checks only first email. If you want to read all the emails and save all the attachments to specific folder. Please check the below screenshot. Hope it helps.

         I am using another criteria(isRead=unread  : filters only unread emails) along with subject. So, after saving the attachment, using Set Read to true such that the email will not reflect if we run the automation again. It will help you to reduce the duplicate attachments.



      Author's profile photo Hrithik Sahu
      Hrithik Sahu

      Well written.