Every 10 minutes
Save email attachments to OneDrive and share them in Teams
Attachments from your inbox are saved to OneDrive and your Teams channel gets a message with a link to each one.
- Runs
- Every 10 minutes
- Apps
- Microsoft Teams, OneDrive
- AI
- Not needed
- Access
- Mail.Read, Files.ReadWrite, ChannelMessage.Send
Send this to your assistant
Create a ClickRuntime automation: every 10 minutes, save attachments from new Outlook emails to the Shared Inbox Files folder in OneDrive and post a link to each in our Teams channel.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
When a client sends a brief, a supplier sends a price list or a customer sends photos, the file lands in one person's inbox. The rest of the team only sees it if that person remembers to forward it.
Saving each attachment to OneDrive and posting a link in the team's Teams channel puts new files in front of everyone who needs them, without email forwarding or attachments copied across chats.
What you get out of it
The team sees files straight away
A message with a link appears in Teams as soon as the email arrives. Nobody waits for a forward.
One copy, not many
Everyone opens the same file in OneDrive. There's no confusion over which attachment is the latest.
Context included
Each post says who sent the file and the email subject. People know what they're looking at.
Files kept tidy
Attachments are saved to a shared folder instead of scattered across inboxes.
How it works
What happens, step by step
Every 10 minutes it looks for new emails with attachments.
Inline images like signature logos are skipped.
Each attachment is saved to a shared OneDrive folder.
A message with the sender, subject and a link to the file is posted to your Teams channel.
It remembers the newest email it handled, so nothing is posted twice.
Before it runs live
- Connect Microsoft Teams
- Connect OneDrive
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 OneDrive steps into one automation
Under the hood
The code that runs this automation
GRAPH = "https://graph.microsoft.com/v1.0"
import base64
from clickruntime import on_trigger, credentials, http, state, report_fetched
TEAM_ID, CHANNEL_ID = "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}",
"$orderby": "receivedDateTime", "$select": "id,subject,from,receivedDateTime"}).json()["value"]
report_fetched(len(msgs))
if not msgs:
return {"summary": "Nothing new"}
posted = 0
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
item = http.put(f"{GRAPH}/me/drive/root:/Shared Inbox Files/{a['name']}:/content", headers=h,
data=base64.b64decode(a["contentBytes"])).json()
html = f"📎 <a href='{item['webUrl']}'>{a['name']}</a> from {m['from']['emailAddress']['address']} — {m['subject']}"
http.post(f"{GRAPH}/teams/{TEAM_ID}/channels/{CHANNEL_ID}/messages", headers=h, json={"body": {"contentType": "html", "content": html}})
posted += 1
state.set("since", msgs[-1]["receivedDateTime"])
return {"posted": posted}FAQ
Common questions
Can I limit it to certain senders?
Who can open the links?
Are signature images posted?
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
Save notes and business cards from a Teams chat to OneDrive
Post a note or contact details in a Teams chat and a tidy version is saved to OneDrive, with a reply confirming it.
See how it worksSave a monthly report to OneDrive and share it in Teams
At the start of each month a report with last month's figures and a short summary is saved to OneDrive and posted to your Teams channel.
See how it worksSee new job listings as they're posted
Jobs that match your keywords show up in a Slack channel, each one only once.
See how it worksKeep exploring
Set up “Save email attachments to OneDrive and share them in Teams” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.