Microsoft 365
A Microsoft 365 connection reaches one Outlook mailbox and one SharePoint or OneDrive folder in your organization. New mail in the mailbox can start a flow, a flow can send mail as that mailbox, and flows can read, update and save files in the folder.
What you are approving
Lumen signs in to your organization as its own Microsoft Entra app, with permissions an admin of your organization approves once. Lumen never asks for a user's password and keeps none.
Approving Lumen does not open your mail or your files. It takes two further grants, each for one thing:
| Grant | Opens | Where an admin gives it |
|---|---|---|
| Approve Lumen | Nothing by itself. Lumen asks Entra only for the right to sign in and for access to SharePoint sites that an admin picks one by one (Sites.Selected). It asks for no mail permission. | The Approve in Microsoft 365 button |
| The mailbox | The one mailbox you named: read and update its mail (Application Mail.ReadWrite) and send as it (Application Mail.Send). Exchange enforces the limit with a management scope, so Lumen cannot reach any other mailbox. | A PowerShell script in Exchange Online |
| The site | The one SharePoint site you named, with write access. | A PowerShell script for SharePoint |
Until both scripts have run, Lumen sees no mail and no files. A shared mailbox works as well as a personal one.
Connect it
You need to be a workspace admin, and a Global Administrator or Application Administrator of your Microsoft 365 organization must be available for the approval.
- Console
- YAML
Add the connection
- In the sidebar, open Connectors, click Add connection and choose Microsoft 365.
- Give it a Name, such as
Accounts payable. - Under Mailbox, enter the address Lumen reads and sends as. A shared mailbox works too.
- Under SharePoint site, enter the site's address, such as
https://acme.sharepoint.com/sites/Finance. Leave it empty to use the mailbox's OneDrive. - Optionally set Document library (empty is the site's main library, Documents) and Folder. File paths in your flows start at the folder.
- Click Add Microsoft 365.
Approve Lumen
- Open the connection. It shows Needs setup.
- Click Approve in Microsoft 365. A Global Administrator or Application Administrator signs in to Microsoft and accepts.
- Back in Lumen, Microsoft 365 organization shows your organization's id, who approved and when. A person who is not an admin of that organization cannot complete the approval.
Give Lumen only the mailbox and the site
After the approval the panel shows two steps with a script each. Expand a step, click Copy the script, and run it:
- Give Lumen only the mailbox, in Exchange Online PowerShell. It creates a management scope limited to your mailbox and gives Lumen the
Application Mail.ReadWriteandApplication Mail.Sendroles on that scope. - Give Lumen only the SharePoint site, in PowerShell, signed in as an admin. It grants Lumen write access to your site.
The scripts are filled in with your mailbox and site. The mailbox script has one value left for you: the object id of the Lumen enterprise application in your organization, which you find in the Entra admin center under Enterprise applications. The script ends with a check that should report the mailbox as in scope. Click Test connection to confirm. If it fails, the message says what is missing: Microsoft refused Lumen (the approval or a script has not run), or there is no such mailbox, site, library or folder (check the spelling).
apiVersion: lumen.ai/v1alpha1
kind: Connector
metadata:
name: ap-365
namespace: tenant-acme
spec:
classRef: {name: microsoft-365}
config:
mailbox: ap@acme.example
site: https://acme.sharepoint.com/sites/Finance
folderPath: Invoices
There is no credential to write: a connection holds no password or client secret of yours. tenantId is filled in by Lumen when an admin of your organization approves it, so never set it by hand. Apply the resource, then open the connection in the console to approve it and copy the two scripts.
A Lumen installation needs its own Microsoft Entra app before Microsoft 365 connections work. Without it the console says Microsoft 365 is not set up for this installation yet.
What flows can do with it
No new steps are involved. The ones you know reach the connection.
| In a flow | How it uses the connection |
|---|---|
| Trigger An email arrives, Source Your mailbox | Starts a run for each new message in the folder. Pick the Microsoft 365 connection under Which mailbox starts this flow?. The settings are those of any mailbox. |
| Send it to me by email, Send as a Microsoft 365 mailbox | Sends as the mailbox, attachments included, and the message is in its Sent Items. Empty sends from Lumen's address. |
| Read a spreadsheet, Update a spreadsheet | Set the file to connection:<name>/<path> to use a file under the connection's folder. |
| Save the file, saving to a connection | Writes each file to the connection's folder, or a Folder in the connection under it. |
A few behaviors worth knowing:
- Reading mail. Lumen asks Microsoft for changes in the folder, so a new trigger starts from now unless you set Import existing mails (newest). Each message is fetched once and goes through the same intake as other email, including the same Start only when check.
- After the flow has the email. Mark it as read and Move it to a folder are done in Outlook.
- Sending. A retried step looks in Sent Items first, so a worker lost mid-send never sends the message twice. Attachments over 3 MB go through a draft, and Lumen refuses to send more than 25 MB of attachments in one message.
- Saving files. A file with the same name becomes a new version in SharePoint, which keeps the old ones.
- Editing a workbook. When a flow updates a spreadsheet it read from the connection, Lumen writes it back only if nobody changed the file in the meantime. Otherwise the step fails with "the file changed in Microsoft 365 since Lumen read it", and nothing is overwritten.
- If access is lost, the connection shows Not working with the reason (for example, the mailbox is not granted), and the workspace's admins are told.
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: ap-invoices
namespace: tenant-acme
spec:
displayName: File supplier invoices and confirm
triggers:
- id: email
ref: {name: mailbox-email}
connectorRef: {name: ap-365}
config:
pollMinutes: 5
attachments: separate
requireAttachment: true
when: {field: email.subject, op: contains, value: invoice}
next: [keep]
nodes:
- id: keep
stepRef: {name: save-file}
config:
destination: connector
connectorRef: ap-365
connectionFolder: Received
next: [confirm]
- id: confirm
stepRef: {name: send-email}
config:
from: ap-365
to: finance@acme.example
subject: "Invoice filed: {email.subject}"
body: "The invoice from {email.from} is in SharePoint, in Invoices/Received."
The flow starts on each attachment of a message whose subject contains invoice, saves the file under Invoices/Received on the site, and sends a note to the finance team as the accounts payable mailbox.
Remove or change access
- Pause stops the connection reading and sending. Resume turns it back on.
- Approve again (shown in the panel once approved) repeats the approval, for example after a different admin takes over.
- To end access completely, remove Lumen's grants in Exchange and SharePoint, and remove the Lumen app from your organization's enterprise applications in Entra. Disconnect removes the connection in Lumen.

