Microsoft 365 (Apps step)

Updated Nov 23, 2026
DataMagik Automate

Microsoft 365

Lists, searches, downloads and uploads SharePoint and OneDrive files and makes folders, reads, adds, updates and deletes SharePoint list items, and sends mail from a Microsoft 365 mailbox, through Microsoft Graph.

Use it to work with the company's Microsoft 365 from a workflow: file a generated certificate in a SharePoint library, pick up a spreadsheet someone saved to a folder, log each shipment in a SharePoint list, or send mail from a shared mailbox such as quality@.

Beta. This step has not yet been checked against a live Microsoft 365 account, so treat its first runs as a test, and tell us if an operation does not answer as described.

Find it in the workflow editor's palette under Apps. See Apps steps for what every Apps step has in common.

Set it up

  1. In the Microsoft Entra admin center, open App registrations › New registration, register an app for this organization only, and note its Application (client) ID and Directory (tenant) ID.
  2. Under API permissions › Add a permission › Microsoft Graph › Application permissions, add Files.ReadWrite.All (files), Sites.ReadWrite.All or Sites.Selected (lists; Sites.Selected also needs each site granted to the app) and Mail.Send (mail), then click Grant admin consent.
  3. Under Certificates & secrets › Client secrets, create a secret and copy its Value (it is shown once).
  4. Add graph.microsoft.com to Allowed Domains in the workflow's Script settings.

Credential: An OAuth 2.0 client credentials credential for a Microsoft Entra app: its Application (client) ID, a client secret, and the token URL with your Directory (tenant) ID in it.

Signing in with OAuth 2.0

Grant typeClient credentials
Token URLhttps://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token
Scopehttps://graph.microsoft.com/.default

Replace <tenant-id> in the token URL with your Directory (tenant) ID from the app's Overview page. Register the app in Microsoft Entra ID, add the Microsoft Graph APPLICATION permissions it needs (Sites.ReadWrite.All or Sites.Selected, Mail.Send, Files.ReadWrite.All), grant admin consent, and create a client secret; the app signs in as itself, so no one clicks Connect.

Hosts it calls: graph.microsoft.com

Operations

OperationWhat it does
File › List folderLists the files and folders in a folder of a OneDrive or SharePoint library.
File › DownloadDownloads a file from a OneDrive or SharePoint library by its path.
File › UploadUploads a file to a OneDrive or SharePoint library, replacing a file already at that path. Graph takes files up to 250 MB this way.
File › SearchFinds files and folders in a OneDrive or SharePoint library whose name, content or metadata match the search text.
Folder › CreateMakes a folder inside a folder of a OneDrive or SharePoint library. The parent must be a folder below the library's top folder: this path form cannot name the top folder itself.
List item › ListLists the items in a SharePoint list, with their column values.
List item › AddAdds an item to a SharePoint list.
List item › UpdateChanges column values on one SharePoint list item; columns you leave out keep their values.
List item › DeleteDeletes one item from a SharePoint list.
Mail › SendSends an email from a Microsoft 365 mailbox.
Site › SearchFinds SharePoint sites by name, so you can see their ids.
Site › ListsLists a site's lists and libraries.

File › List folder

Lists the files and folders in a folder of a OneDrive or SharePoint library.

Calls GET /drives/{driveId}/root:/{folderPath}:/children. Follows the pages, up to Most pages (10 unless you change it).

FieldRequiredWhat to put
Drive IDYesThe library's drive id, starting b!; Graph Explorer's GET /sites/{site id}/drive gives it (see the tips). For example b!AbCdEf….
Folder pathYesThe folder, from the library's top folder, with / between folders, such as Incoming/Price lists. For example Incoming/Price lists.

What comes out: One item per file or folder in it, following every page up to 10 pages: {{ $json.id }}, {{ $json.name }}, {{ $json.size }} (bytes), {{ $json.lastModifiedDateTime }}, {{ $json.webUrl }}, and {{ $json.file }} with {{ $json.file.mimeType }} for a file or {{ $json.folder }} with {{ $json.folder.childCount }} for a folder.

Example: List Incoming/Price lists each morning, keep the items whose {{ $json.file }} is set, and download each one.

File › Download

Downloads a file from a OneDrive or SharePoint library by its path.

Calls GET /drives/{driveId}/root:/{filePath}:/content. Puts out the downloaded file in {{ $json.file }}.

FieldRequiredWhat to put
Drive IDYesThe library's drive id, starting b!; Graph Explorer's GET /sites/{site id}/drive gives it (see the tips). For example b!AbCdEf….
File pathYesThe file, from the library's top folder, with / between folders and the file name last, such as Certs/2026/C-1042.pdf. For example Certs/2026/C-1042.pdf.

What comes out: One item: {{ $json.file }}, the downloaded file (with filename, mimeType and size), ready for Read Excel, Send Email attachments or another upload, plus {{ $json.status }}. A download is held in the run, so files larger than 10 MB cannot be downloaded here.

Example: Download Incoming/Price lists/{{ $json.name }} for each file List folder found and pass {{ $json.file }} to Read Excel.

File › Upload

Uploads a file to a OneDrive or SharePoint library, replacing a file already at that path. Graph takes files up to 250 MB this way.

Calls PUT /drives/{driveId}/root:/{filePath}:/content.

FieldRequiredWhat to put
Drive IDYesThe library's drive id, starting b!; Graph Explorer's GET /sites/{site id}/drive gives it (see the tips). For example b!AbCdEf….
File pathYesThe file, from the library's top folder, with / between folders and the file name last, such as Certs/2026/C-1042.pdf. For example Certs/2026/C-1042.pdf.
FileYesThe file to upload: a generated document, an upload, or Read File's or Download's {{ $json.file }}. For example {{ $json.file }}.

What comes out: One item: the uploaded file, with {{ $json.id }}, {{ $json.name }}, {{ $json.size }}, {{ $json.webUrl }} (its address in SharePoint or OneDrive) and {{ $json.lastModifiedDateTime }}.

Example: Upload the generated certificate {{ $json.file }} to Certs/{{ $json.customer }}/{{ $json.po }}.pdf and put {{ $json.webUrl }} in the shipment email.

File › Search

Finds files and folders in a OneDrive or SharePoint library whose name, content or metadata match the search text.

Calls GET /drives/{driveId}/root/search(q='{query}'). Follows the pages, up to Most pages (10 unless you change it).

FieldRequiredWhat to put
Drive IDYesThe library's drive id, starting b!; Graph Explorer's GET /sites/{site id}/drive gives it (see the tips). For example b!AbCdEf….
Search textYesWords to look for in file names and contents, such as C-1042. Write an apostrophe twice: O''Brien. For example C-1042.

What comes out: One item per file or folder found anywhere in the library, following every page up to 10 pages: {{ $json.id }}, {{ $json.name }}, {{ $json.size }} (bytes), {{ $json.lastModifiedDateTime }}, {{ $json.webUrl }}, {{ $json.parentReference.id }} (its folder's id), and {{ $json.file }} for a file or {{ $json.folder }} for a folder.

Example: Search the Quality library for {{ $json.po }} and email the {{ $json.webUrl }} of every certificate found.

Folder › Create

Makes a folder inside a folder of a OneDrive or SharePoint library. The parent must be a folder below the library's top folder: this path form cannot name the top folder itself.

Calls POST /drives/{driveId}/root:/{parentPath}:/children.

FieldRequiredWhat to put
Drive IDYesThe library's drive id, starting b!; Graph Explorer's GET /sites/{site id}/drive gives it (see the tips). For example b!AbCdEf….
Parent folder pathYesThe folder to make the new folder in, from the library's top folder, with / between folders, such as Certs/2026. It cannot be the top folder itself. For example Certs/2026.
Folder nameYesThe new folder's name, such as the customer or PO number. For example {{ $json.customer }}.
Folder settingsNoLeave as {}: it tells Graph to make a folder rather than a file.
If it existsNoWhat to do when the parent already has an item with that name: fail the step, make the folder with a number added to its name, or replace the existing one (and its contents). One of: Fail, Make another with a new name, Replace it.

What comes out: One item: the new folder, with {{ $json.id }}, {{ $json.name }} (with a number added when it was renamed), {{ $json.webUrl }}, {{ $json.createdDateTime }} and {{ $json.folder.childCount }} (0).

Example: For each new PO, create the folder {{ $json.po }} in Certs/{{ $json.customer }}, then upload the PO's certificates into it.

List item › List

Lists the items in a SharePoint list, with their column values.

Calls GET /sites/{siteId}/lists/{listId}/items. Follows the pages, up to Most pages (10 unless you change it).

FieldRequiredWhat to put
Site IDYesThe site's id, three parts separated by commas; Graph Explorer's GET /sites/{hostname}:/sites/{site name} gives it (see the tips). For example acme.sharepoint.com,1a2b…,3c4d…. Choose from list beside the field fetches the choices from your account.
ListYesThe list's name as SharePoint shows it, or its id. For example Shipments. Choose from list beside the field fetches the choices from your account.
ExpandNoLeave as fields to get each item's column values; fields(select=Title,PartNumber) gets only those columns.

What comes out: One item per list item, following every page up to 10 pages: {{ $json.id }}, {{ $json.webUrl }}, {{ $json.createdDateTime }}, {{ $json.lastModifiedDateTime }} and {{ $json.fields }} with the column values by internal name, such as {{ $json.fields.Title }}.

Example: List the Open NCRs list each morning and email the owners whose {{ $json.fields.DueDate }} has passed.

List item › Add

Adds an item to a SharePoint list.

Calls POST /sites/{siteId}/lists/{listId}/items.

FieldRequiredWhat to put
Site IDYesThe site's id, three parts separated by commas; Graph Explorer's GET /sites/{hostname}:/sites/{site name} gives it (see the tips). For example acme.sharepoint.com,1a2b…,3c4d…. Choose from list beside the field fetches the choices from your account.
ListYesThe list's name as SharePoint shows it, or its id. For example Shipments. Choose from list beside the field fetches the choices from your account.
Column valuesYesA JSON object of column internal names and values; Title is the list's default first column. For example {"Title": "{{ $json.po }}", "PartNumber": "{{ $json.part }}", "Quantity": 12}.

What comes out: One item: the new list item, with {{ $json.id }}, {{ $json.webUrl }}, {{ $json.createdDateTime }} and {{ $json.fields }} as SharePoint saved them.

Example: Add {"Title": "{{ $json.po }}", "Customer": "{{ $json.customer }}", "Shipped": "{{ $json.shipped_at }}"} to the Shipments list for every truck that leaves.

List item › Update

Changes column values on one SharePoint list item; columns you leave out keep their values.

Calls PATCH /sites/{siteId}/lists/{listId}/items/{itemId}/fields.

FieldRequiredWhat to put
Site IDYesThe site's id, three parts separated by commas; Graph Explorer's GET /sites/{hostname}:/sites/{site name} gives it (see the tips). For example acme.sharepoint.com,1a2b…,3c4d…. Choose from list beside the field fetches the choices from your account.
ListYesThe list's name as SharePoint shows it, or its id. For example Shipments. Choose from list beside the field fetches the choices from your account.
Item IDYesThe list item's id, a number; List items gives it as {{ $json.id }}. For example 42.
Column valuesYesA JSON object of the columns to change, by internal name, and their new values; only these columns change. For example {"Status": "Closed", "ClosedOn": "{{ $json.closed_at }}"}.

What comes out: One item: the item's column values as they now are, by internal name, such as {{ $json.Title }} and {{ $json.Status }}, with {{ $json.id }}.

Example: When an NCR is dispositioned, update item {{ $json.ncr_item_id }} in the Open NCRs list with {"Status": "Closed", "Disposition": "{{ $json.disposition }}"}.

List item › Delete

Deletes one item from a SharePoint list.

Calls DELETE /sites/{siteId}/lists/{listId}/items/{itemId}.

FieldRequiredWhat to put
Site IDYesThe site's id, three parts separated by commas; Graph Explorer's GET /sites/{hostname}:/sites/{site name} gives it (see the tips). For example acme.sharepoint.com,1a2b…,3c4d…. Choose from list beside the field fetches the choices from your account.
ListYesThe list's name as SharePoint shows it, or its id. For example Shipments. Choose from list beside the field fetches the choices from your account.
Item IDYesThe list item's id, a number; List items gives it as {{ $json.id }}. For example 42.

What comes out: Graph answers 204 No Content, so the step puts out one item with {{ $json.status }} (204) and an empty {{ $json.body }} when the item was deleted.

Example: Each night, List items finds the Pick List items whose {{ $json.fields.Picked }} is set, and Delete removes each one by its {{ $json.id }}.

Mail › Send

Sends an email from a Microsoft 365 mailbox.

Calls POST /users/{mailbox}/sendMail.

FieldRequiredWhat to put
From mailboxYesThe mailbox to send as: its email address (user principal name), such as quality@acme.com. For example quality@acme.com.
SubjectYesThe email's subject.
Body formatNoWhether the body is plain text or HTML. One of: Plain text, HTML.
BodyNoThe email's text, or its HTML when Body format is HTML.
ToYesA JSON list of recipients, each written as {"emailAddress": {"address": "…"}}. For example [{"emailAddress": {"address": "buyer@example.com"}}].
Save to Sent ItemsNoKeep a copy in the mailbox's Sent Items folder.

What comes out: Graph answers 202 Accepted with no body, so the step puts out one item with {{ $json.status }} (202) and an empty {{ $json.body }} when the mail was accepted for sending.

Example: Send from quality@acme.com to the customer's buyer with the subject Certificate for PO {{ $json.po }} and the SharePoint link in the body.

Site › Search

Finds SharePoint sites by name, so you can see their ids.

Calls GET /sites.

FieldRequiredWhat to put
Site name containsNoWords in the site's name; * lists every site the app may read.

What comes out: One item per site: {{ $json.id }} (what Site ID fields take), {{ $json.displayName }}, {{ $json.name }} and {{ $json.webUrl }}.

Example: Search for Quality to find the Quality site's id, then use it in List items.

Site › Lists

Lists a site's lists and libraries.

Calls GET /sites/{siteId}/lists. Follows the pages, up to Most pages (10 unless you change it).

FieldRequiredWhat to put
Site IDYesThe site's id, three parts separated by commas; Graph Explorer's GET /sites/{hostname}:/sites/{site name} gives it (see the tips). For example acme.sharepoint.com,1a2b…,3c4d…. Choose from list beside the field fetches the choices from your account.

What comes out: One item per list or library: {{ $json.id }}, {{ $json.displayName }}, {{ $json.webUrl }} and {{ $json.list.template }} (genericList for a list, documentLibrary for a library).

Example: See which lists the Quality site has before adding an item to its NCR list.

Trigger: Microsoft 365: New Items

Under Triggers in the palette. It looks at Microsoft 365 on a schedule (every 15 minutes unless you change Look every) with one of these operations: File › List folder; File › Search; List item › List; Site › Lists, and starts the workflow with the items it has not seen on an earlier look, one item each. Saving the workflow sets up the schedule.

  • New means: not seen before, by the item's id (or the field you name in Item field), or newer than the newest one last time, by a date or increasing number.
  • On the first run it only remembers what is there, unless you choose Start with everything.
  • Test runs show what would be new without remembering it. It remembers the last 5000 ids, so filter the list to keep it shorter than that.

Example

When a Certificate of Conformance is generated, Microsoft 365 › Upload file puts {{ $json.file }} in the Quality library at Certs/{{ $json.customer }}/{{ $json.po }}.pdf, and Microsoft 365 › Add list item logs the PO and file link in the Shipments list.

Tips

  • Find the site id in Graph Explorer (developer.microsoft.com/graph/graph-explorer): GET https://graph.microsoft.com/v1.0/sites/acme.sharepoint.com:/sites/Quality gives the Quality site's id. GET /sites/{site id}/drive then gives its Documents library's drive id; GET /sites/{site id}/drives lists every library.
  • File and folder paths are relative to the library's top folder, with / between folders: Certs/2026/C-1042.pdf. Do not include the library's name.
  • List columns go by their internal names, which can differ from what SharePoint shows: a column created as Part Number is often PartNumber or Part_x0020_Number. List items shows them in {{ $json.fields }}.
  • Mail.Send as an application permission lets the app send as any mailbox; ask your Exchange admin to limit it to the mailboxes you use with an application access policy.
  • It reads and writes the real tenant on test runs too, so use a test site or folder while building.

Settings every Apps step has

  • More query parameters: any query parameter the fields do not offer, sent as is.
  • More body fields: a JSON object merged into the request body; nested objects merge, other values replace.
  • Most requests per second: spaces the calls out for rate limits. A "too many requests" (429) answer is retried after the wait the API asks for.
  • Most pages: for operations that follow pages, the most pages to fetch (10 unless you change it, up to 100). The run warns when it stops with more to get.
  • Fail on a non-2xx response: on by default. Turn it off to handle errors yourself.

Microsoft 365's own API documentation: https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0

Was this page helpful?