📧 Save Emails to OneDrive with Conditions | DAY-4

🔹 Flow Objective

Today we’ll build a real, beginner-friendly flow that thinks before it acts using a Condition.

Whenever a new email arrives in your Outlook inbox:

  • If the email has an attachment → save the full email in the WithAttachment folder in OneDrive.
  • If the email does not have an attachment → save the email in the WithoutAttachment folder.

🔹 Step-by-Step Guide

1) Trigger

  • Action: When a new email arrives (V3) – Office 365 Outlook connector
  • Configuration:
    • Folder: Inbox
    • Include Attachments: No
    • Only with Attachments: No

2) Export the Email

  • Action: Export email (V2) – Office 365 Outlook connector
  • Message Id: from trigger (Message Id)

👉 This action converts the incoming email into an .eml file, preserving formatting, body, and headers.


3) Add Condition

  • Action: Condition
  • Rule:
    • Has Attachments (from trigger)
    • is equal to
    • true

4) YES Branch (If Has Attachments = True)

  • Action:Create file – OneDrive for Business connector
    • Folder Path: /Emails/WithAttachment
    • File Name: @{formatDateTime(utcNow(),'yyyyMMdd_HHmmss')}_WithAttachment.eml OR
    • File Name: WithAttachment_Received time.eml (add received time using Dynamic content from Export Email (V2) connector’s output)
    • File Content: Exported Email (ContentBytes) from Export Email (V2)

5) NO Branch (If Has Attachments = False)

  • Action:Create file – OneDrive for Business connector
    • Folder Path: /Emails/WithoutAttachment
    • File Name: @{formatDateTime(utcNow(),'yyyyMMdd_HHmmss')}_WithoutAttachment.eml OR
    • File Name: WithoutAttachment_Received time.eml (add received time using Dynamic content from Export Email (V2) connector’s output)
    • File Content: Exported Email (ContentBytes) from Export Email (V2)

6) Save & Test

  • Save the flow.
  • Send two emails to your email account:
    • One with an attachment.
    • One without an attachment.
  • Check your OneDrive for Business:
    • /Emails/WithAttachment → contains emails with attachments.
    • /Emails/WithoutAttachment → contains emails without attachments.

🔹 Benefits of This Flow

✅ Automates email organization in OneDrive for Business.
✅ Saves emails in .eml format, ready to be opened in Outlook or other clients.
✅ Handles attachments logic automatically with a simple condition.
✅ Great example for learning conditions in Power Automate.


Testimonial:

I used to spend way too much time sifting through my inbox, trying to find that one email with the attachment I needed. It was a productivity killer. So, I decided to fight back with a little help from Microsoft Power Automate!

I created a simple but incredibly effective flow. It automatically checks my incoming emails. The result? No more manual dragging and dropping. No more frantic searching. Just clean, automated organization. It’s a small change that has made a huge impact on my daily workflow.

Vinod Gill

Aspiring Automation Enthusiast


Discover more from Quickinfoz

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Quickinfoz

Subscribe now to keep reading and get access to the full archive.

Continue reading

Subscribe