Skip to content

Outlook Connect

Type: outlook-connect  ·  Package: Outlook Activities v1.0.4  ·  Output: ZoanOutlookSession

Opens an Outlook session and returns a ZoanOutlookSession. It is not mandatory: the other activities work on their own with the default account. Use Connect when you need a specific account (other than the default) or will run several operations in a row: they all share a single connection to Outlook instead of opening one per activity.

Connects to the installed Outlook (starting it in the background if it is not open) and stores the account given in account (or none, to use the default one). Two modes:

  • With body: the activities inside inherit the session (and its account) automatically, and it closes by itself at the end, also when an activity in the body fails.
  • Without body: returns the session as output; pass it as session to the activities and close it with Outlook Close.

The account is used at two points:

  • When sending (Outlook Send Email): the email goes out from the account whose display name or SMTP address matches account.
  • When resolving folders: paths are looked up from the root of that account’s mailbox (see Folders).

Connect does not validate the account when opening the session: if no account in the profile matches account, emails are sent from the default account and folders are looked up in the default mailbox. Make sure the text matches the name or address Outlook shows (case-insensitive).

Requirements: Outlook installed with a configured mail profile, in a user session, at the same elevation level as the robot.

None.

ParameterTypeDefaultDescription
accountstring—Account display name or email address (e.g. "support@company.com"). Leave empty to use the profile’s default account.

Optional. Activities run with this session; they inherit it without setting session. On exit (success or error) the session is closed. If the body is empty, the activity returns the session as output.

  • Without body: returns a ZoanOutlookSession. Pass it as session to the other Outlook activities and close it with Outlook Close.
  • With body: does not return a value (the session only exists inside the body).
MessageCause and fix
COM component 'Outlook.Application' is not registered. Is the application installed?Outlook desktop is not installed on the robot’s machine. Install it, or use the SMTP/IMAP package, which does not need it.
COM error when creating the instance (access denied, server unavailable)Outlook is open at a different elevation level than the robot, or there is no user session. Run both at the same level in an interactive session.

Process the mail of a shared account and forward from it:

Outlook Connect account = "invoices@company.com"
└─ body:
Outlook Get Emails folder = "Inbox" unreadOnly = true → output: emails
For Each items = emails itemVariable = email
└─ activities:
Outlook Get Attachments entryId = email.Id outputDir = "C:/invoices" → output: files
Outlook Send Email to = "accounting@company.com" subject = "Invoice received: " + email.Subject attachments = files
Outlook Mark Read entryId = email.Id