Every 15 minutes
Archive email attachments to a SharePoint library
Attachments from incoming emails are saved to your SharePoint library by date, with a log of what was filed.
- Runs
- Every 15 minutes
- Apps
- Outlook, SharePoint
- AI
- Not needed
- Access
- Mail.Read, Sites.ReadWrite.All
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, save attachments from new Outlook emails into the Inbox Files library in SharePoint, in a folder per month, and add a row to the Attachment Log list.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Contracts, purchase orders and signed forms arrive as email attachments and stay there, in one person's mailbox. When that person is off or leaves, nobody else can find the file, and auditors want documents kept somewhere official.
Filing every attachment into a SharePoint library as it arrives puts the documents where the whole team, and your retention policies, can reach them, with a log showing who sent each file and when.
What you get out of it
Files the whole team can find
Documents live in SharePoint instead of one inbox. Anyone with access can search for them.
Covered by your retention rules
SharePoint libraries carry your organisation's retention and backup policies. Email attachments in personal mailboxes often don't.
A clear trail
Each saved file is logged with sender, subject and date. That answers 'when did we receive this?' quickly.
No manual saving
Nobody has to drag files out of Outlook. It happens every 15 minutes, including when you're away.
How it works
What happens, step by step
Every 15 minutes it looks for new emails with attachments.
Inline images like signature logos are skipped.
Each attachment is saved into a monthly folder in your SharePoint library.
A row is added to a log list with the file name, sender and date.
It remembers the newest email it handled, so files aren't saved twice.
Before it runs live
- Connect Outlook
- Connect SharePoint
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 Outlook and SharePoint steps into one automation
Under the hood
The code that runs this automation
GRAPH = "https://graph.microsoft.com/v1.0"
SITE = "contoso.sharepoint.com:/sites/operations:"
import base64
from clickruntime import on_trigger, credentials, http, state, report_fetched
@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"}
saved = 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
path = f"{m['receivedDateTime'][:7]}/{a['name']}"
http.put(f"{GRAPH}/sites/{SITE}/drive/root:/Inbox Files/{path}:/content", headers=h, data=base64.b64decode(a["contentBytes"]))
log = {"fields": {"Title": a["name"], "Sender": m["from"]["emailAddress"]["address"], "Subject": m["subject"]}}
http.post(f"{GRAPH}/sites/{SITE}/lists/Attachment Log/items", headers=h, json=log)
saved += 1
state.set("since", msgs[-1]["receivedDateTime"])
return {"saved": saved}FAQ
Common questions
Are inline images and signatures saved too?
How are files organised?
What if two files have the same name?
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
Record decisions from meeting summaries in SharePoint
Decisions and action items from meeting summary emails are added to SharePoint lists, so nothing agreed gets lost.
See how it worksEmail timesheet reminders to staff listed in SharePoint
Twice a week everyone on your staff list gets a personal reminder from Outlook to submit their timesheet.
See how it worksLog form submissions in a SharePoint list and email the owner
Every form submission becomes an item in your SharePoint list, the right person is emailed, and the sender gets an acknowledgement.
See how it worksKeep exploring
Set up “Archive email attachments to a SharePoint library” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.