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.
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
Every 15 minutes, ClickRuntime checks your Outlook inbox for emails with attachments received since the last check.
It skips emails it has already handled.
Each attached file is saved to the Attachments folder in your OneDrive, with the date added to its name.
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
Build your own
Need it to work differently?
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
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?
What if two files have the same name?
Can I save only attachments from certain senders?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Turn action emails in Outlook into Planner tasks with a Teams alert
Flagged or action emails in Outlook become Planner tasks, and the team is told about each one in Teams.
See how it worksPost today's Outlook meetings to Teams each morning
Every weekday at 8, today's Outlook meetings with times and attendees are posted to your Teams channel.
See how it worksGet a Teams briefing before important meetings
Before each meeting with external attendees, you get a Teams message summarising your recent Outlook emails with them.
See how it worksKeep exploring
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.