Outlook 365 — Connect
Outlook 365 — Connect
Section titled “Outlook 365 — Connect”Type: outlook365-connect · Package: Outlook 365 v1.0.4 · Output: ZoanOutlookMailSession
Opens an authenticated session with Outlook 365 (Microsoft 365) through Microsoft Graph. It is the package’s starting point: every other activity (send, search, reply, move…) works on this session.
How it works
Section titled “How it works”It authenticates with a Zoan Cloud Microsoft 365 OAuth connection. There are two ways to use it:
- With
body: the activities you place inside inherit the session automatically; when the block ends (also if something inside fails), the session closes by itself. - Without
body: it returns the session as output; store it in a variable, pass it throughsessionto the other activities and close it with Outlook 365 — Close.
When connecting:
- It reads the connection’s access token. If it is empty, it fails right away.
- If you set
mailbox, the session works on that mailbox. It tries to read the mailbox’s primary address from Graph; if it can’t (for example, because the connection has no permission to read users), it uses themailboxvalue as is and carries on. - Without
mailbox, it looks up the connection’s user (/me) and works on that user’s mailbox.
Connect does not check access to the emails yet: if permissions are missing, the error shows up in the first activity that uses them.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
credential | credential | — | Zoan Cloud Microsoft 365 OAuth connection. Pick it in the Designer’s selector or write credential("key-name") with its key name. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
mailbox | string | — | Mailbox to work on (email or UPN, e.g. billing@example.com). Required with app-only access or for shared mailboxes. Empty = the mailbox of the connection’s user. |
Sub-flows
Section titled “Sub-flows”body optional
Section titled “body optional”Activities to run inside the session. They inherit the session automatically and it closes when they finish.
Output
Section titled “Output”Returns a ZoanOutlookMailSession only when you don’t use body; with body the activity returns nothing (the session is inherited). The session exposes two read-only properties:
| Property | Type | Content |
|---|---|---|
Email | string | Address of the connected mailbox (the primary one, if Graph could read it). |
UserKey | string | Identifier used to address the mailbox in Graph: the mailbox you set or the UPN of the connection’s user. |
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'credential' does not contain a valid access_token. Check the Microsoft 365 OAuth Connection in Zoan Cloud. | The connection returned no token: it is pending authorization or was revoked. Open it in Zoan Cloud and check that it is Connected. |
Could not resolve the signed-in user (/me). For app-only access provide the 'mailbox' parameter. | Without mailbox, Graph did not return the current user: the connection is app-only or the token cannot read the profile. Set mailbox. |
Could not resolve the mailbox user. | Graph answered /me without a UPN or ID. Set mailbox explicitly. |
Parameter 'credential' is of type 'credential' but the value was null. … | The connection does not exist in the environment, or the display name was used instead of the key name. |
Example
Section titled “Example”Outlook 365 — Connect credential = credential("m365-support") └─ body: Outlook 365 — Get emails folder = "inbox" unreadOnly = true → output: newEmails For each email in newEmails └─ Outlook 365 — Reply id = email["id"] body = "We received your message and will get back to you shortly."Without body, on a shared mailbox:
Outlook 365 — Connect credential = credential("m365-support") mailbox = "billing@example.com" → output: mbxOutlook 365 — Get emails session = mbx subject = "Invoice" → output: invoicesOutlook 365 — Close session = mbxRelated activities
Section titled “Related activities”- Outlook 365 — Send — send an email.
- Outlook 365 — Get emails — search emails.
- Outlook 365 — Close — close the session (no-
bodymode). - All Outlook 365 activities