Skip to content

Every 15 minutes

Save Outlook attachments to OneDrive and tell Teams

Attachments from new Outlook emails are saved to your OneDrive Attachments folder, and a Teams message lists what arrived.

Runs
Every 15 minutes
Apps
Microsoft Teams, Outlook
AI
Not needed
Access
Mail.Read, Files.ReadWrite, ChannelMessage.Send

Send this to your assistant

Create a ClickRuntime automation: every 15 minutes, save attachments from new Outlook emails to my OneDrive Attachments folder and post a note in our Teams channel listing them.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

An accounts assistant at a construction firm receives invoices, delivery notes and signed forms as email attachments all day. Each one has to be downloaded and filed before the rest of the team can work on it, and when she is away, files sit unopened in her inbox.

Saving attachments to a shared OneDrive folder as they arrive, and posting a note in Teams, gets documents to the people who need them without anyone acting as a filing clerk. Finance teams, office managers and project coordinators use it for invoices, timesheets and paperwork from suppliers.

What you get out of it

  • Documents filed as they arrive

    Attachments land in OneDrive within minutes, not when someone finds time to download them. Nothing waits in an inbox for days.

  • The team knows something has come in

    A Teams message lists each file and who sent it. The right person can pick it up straight away without being forwarded an email.

  • Files in one searchable place

    Every attachment ends up in the same folder, searchable with OneDrive. Finding last quarter's invoice from a supplier no longer means digging through mail.

  • Works when you are away

    Holidays and sick days do not stop the flow of documents. Colleagues can carry on with the files even when the mailbox owner is out.

How it works

What happens, step by step

  1. Every 15 minutes, ClickRuntime checks your Outlook inbox for emails with attachments received since the last check.

  2. It skips emails it has already handled.

  3. Each attached file is saved to the Attachments folder in your OneDrive, with the date added to its name.

  4. A message in your Teams channel lists the saved files and who sent them.

Before it runs live

  • Connect Microsoft Teams
  • Connect Outlook

What you get

RunsEvery 15 minutes
Save Outlook attachments to OneDrive and tell Teamstoday, 9:00Succeeded
Teams · AccountsNew attachments saved to OneDrive: 2026-10-19 INV-4471.pdf from billing@northwind.example, 2026-10-19 delivery-note.pdf from dispatch@contoso.example

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Microsoft Teams and Outlook steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
save_outlook_attachments_and_notify_teams.pyexample
import base64
from clickruntime import on_trigger, credentials, http, state, report_fetched

GRAPH, TEAM_ID, CHANNEL_ID = "https://graph.microsoft.com/v1.0", "your-team-id", "your-channel-id"

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
    since = state.get("since") or "2026-01-01T00:00:00Z"
    msgs = http.get(f"{GRAPH}/me/messages", headers=h, params={"$filter": f"hasAttachments eq true and receivedDateTime gt {since}",
                    "$select": "id,subject,from,receivedDateTime", "$orderby": "receivedDateTime asc"}).json()["value"]
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    saved = []
    for m in msgs:
        for a in http.get(f"{GRAPH}/me/messages/{m['id']}/attachments", headers=h).json()["value"]:
            if a.get("isInline") or "contentBytes" not in a:
                continue
            name = f"{m['receivedDateTime'][:10]} {a['name']}"
            http.put(f"{GRAPH}/me/drive/root:/Attachments/{name}:/content", headers=h, data=base64.b64decode(a["contentBytes"])).raise_for_status()
            saved.append(f"<li>{name} from {m['from']['emailAddress']['address']}</li>")
    if saved:
        http.post(f"{GRAPH}/teams/{TEAM_ID}/channels/{CHANNEL_ID}/messages", headers=h,
                  json={"body": {"contentType": "html", "content": "New attachments saved to OneDrive:<ul>" + "".join(saved) + "</ul>"}})
    state.set("since", msgs[-1]["receivedDateTime"])
    return {"emails": len(msgs), "files": len(saved)}

FAQ

Common questions

Are images in email signatures saved too?
Small inline images such as logos are skipped, and only real attached files are saved. This keeps the folder free of dozens of copies of the same signature graphic.
What if two files have the same name?
Each file is saved with the date at the start of its name, so attachments called invoice.pdf from different days do not overwrite one another.
Can I save only attachments from certain senders?
Yes. It can be limited to particular addresses or domains, such as your suppliers, so personal or unrelated attachments are left in the inbox.
What permissions does it need?
Mail.Read, Files.ReadWrite, ChannelMessage.Send. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Save Outlook attachments to OneDrive and tell Teams” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.