דלג לתוכן הראשי

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.

  • 15 minutes
  • Needs a Microsoft 365 admin
  • Two PowerShell commands

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:

GrantOpensWhere an admin gives it
Approve LumenNothing 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 mailboxThe 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 siteThe 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.

Add the connection​

  1. In the sidebar, open Connectors, click Add connection and choose Microsoft 365.
  2. Give it a Name, such as Accounts payable.
  3. Under Mailbox, enter the address Lumen reads and sends as. A shared mailbox works too.
  4. 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.
  5. Optionally set Document library (empty is the site's main library, Documents) and Folder. File paths in your flows start at the folder.
  6. Click Add Microsoft 365.
The top of the Add connection panel for Microsoft 365. An information box titled An admin approves Lumen once explains that a Global Administrator or Application Administrator presses Approve in Microsoft 365, and then gives Lumen only the mailbox and only the site with two commands. Below it, Name holds Accounts payable. The Mailbox, SharePoint site, Document library and Folder fields follow below the visible part.The top of the Add connection panel for Microsoft 365. An information box titled An admin approves Lumen once explains that a Global Administrator or Application Administrator presses Approve in Microsoft 365, and then gives Lumen only the mailbox and only the site with two commands. Below it, Name holds Accounts payable. The Mailbox, SharePoint site, Document library and Folder fields follow below the visible part.
The top of the connection form. The box says who approves what.

Approve Lumen​

  1. Open the connection. It shows Needs setup.
  2. Click Approve in Microsoft 365. A Global Administrator or Application Administrator signs in to Microsoft and accepts.
  3. 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.
The connection panel of a Microsoft 365 connection that Needs setup. The text says an admin of your organization has not approved Lumen in Microsoft 365 yet. Under Microsoft 365 organization is a blue button, Approve in Microsoft 365, with a note that a Global Administrator or Application Administrator approves Lumen once. Below are Test connection, Flows using it, Pause and Disconnect.The connection panel of a Microsoft 365 connection that Needs setup. The text says an admin of your organization has not approved Lumen in Microsoft 365 yet. Under Microsoft 365 organization is a blue button, Approve in Microsoft 365, with a note that a Global Administrator or Application Administrator approves Lumen once. Below are Test connection, Flows using it, Pause and Disconnect.
Before the approval. Only an admin of your Microsoft 365 organization can complete it.

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:

  1. Give Lumen only the mailbox, in Exchange Online PowerShell. It creates a management scope limited to your mailbox and gives Lumen the Application Mail.ReadWrite and Application Mail.Send roles on that scope.
  2. 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).

Self-hosted installations

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 flowHow it uses the connection
Trigger An email arrives, Source Your mailboxStarts 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 mailboxSends as the mailbox, attachments included, and the message is in its Sent Items. Empty sends from Lumen's address.
Read a spreadsheet, Update a spreadsheetSet the file to connection:<name>/<path> to use a file under the connection's folder.
Save the file, saving to a connectionWrites 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.
ap-invoices.yaml
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.

Next steps​