web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Uploading email attach...
Power Automate
Unanswered

Uploading email attachments to SharePoint - multiple criteria

(0) ShareShare
ReportReport
Posted on by 15

Using Flow, I have a process set up that automatically exports attachments on received emails to a shared mailbox, into a specified folder in SharePoint.

The only logic here is "does email contain attachments", if yes, move attachments to defined folder. This is quite basic though, and so would love to automate this process further. 

 

I'm not fully versed with Flow, so there might well be limitations to the requirements below. The core logic I'm hoping for is "the ability to upload received attachments to a specified folder based on cut-off/deadline dates given in SharePoint List". 

 

Step 1

 

Does email received into shared mailbox contain an attachment(s)? If yes, perform following actions*

 

*I'm fairly happy with this step. A common starting point for lots of Flow Templates. It's the rest where I start getting out of my depth!

 

Step 2

 

Pre-Requisites - An already existing Sharepoint List containing a "Date" column (in which different cut-off/deadline dates are listed e.g. 22/07/20, 25/09/20 & 28/10/20 ) AND a "Folder" column (in which different Sharepoint directories/paths are listed)

 

Actions - If a given date in List is greater than OR equal to "today", 'look-up' the sharepoint directory in the "Folder" column, for that same row as the >= date* As aforementioned, this will be a sharepoint directory folder location (e.g. "....sharepoint.com/sites/RandomCompany/21.08.20_Deadline_Folder")

 

 

*e.g. if email received on 21/08/20, and dates of 22/07/20, 25/09/20 & 28/10/20 are given in the Date column, the logic should point to 25/09/20. This is the next deadline date. 22/07 has already passed, and 28/10 is not the next earliest deadline. So I don't want to look up all dates greater than today, just the next nearest date

 

Step 3

 

Pre-Requisites - A second SharePoint List which has two columns "Company Name" and "Email Address". All email addresses who will be emailing the shared mailbox will be listed here, along with their respective company name.

 

Actions - In SharePoint directory looked-up in Step 2, create a subfolder. The name of this subfolder is based on the SharePoint List which has two columns "Company Name" and "Email Address" i.e. The email address is known from the email received as per step 1. So logic should lookup adjacent company name associated with email, and title subfolder as this. If an existing subfolder already exists with this name, go to step 4, don't create a duplicate folder.

 

Step 4

 

Create a nested folder within the subfolder from step 3. This folder name being the date the email in step 1 was received. All attachments from the email should be uploaded to this location. If the folder name already exists, don't create a new folder, just add attachments to exisiting folder.

 

Step 5

 

Move original email into another folder within the shared mailbox, e.g. "Migrated Attachments" folder.

 

------------------------------------------------------------------------------------------------------------------

 

I can put together some of these pieces, like moving all attachments from emails. And I have an idea I maybe need to use Date ge 'utcNow()'  for the deadlines dates (though would that look up ALL future deadline dates?). But I'm quite lost with the different look-ups, and auto-folder creation. Very new to Power Automate, but can see the massive potential of it.

 

Can anyone assist me with this please? Very grateful for any advice given, or different suggestions to the process I've outlined. If there's an easier way to reach the end-goal, I'd be happy to hear it.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

     

    If you can create a similar Flow according to your vision, it will help us to provide you with appropriate suggestions.

  • Pablo Carceller Profile Picture
    Microsoft Employee on at

    Hello @Anonymous 

     

    You can check the limitation of the connector here, may this ones can help you:

     

    https://docs.microsoft.com/en-us/connectors/office365/

    https://docs.microsoft.com/en-us/connectors/sharepointonline/

     

    Hope this can help!

  • JB-29081013-0 Profile Picture
    15 on at

    Hi @Anonymous

     

    Here's what I have so far.

     

    image.png1) So essentially, if email received in shared mailbox has an attachment(s), this flow creates a new folder in the /SharedDocuments/Test  path. The name of which is the current date*...

     

    • *Required change #1 - Rather than creating a folder named as the current date (hence, a new folder every day), I want a new folder created only when the received date of the email falls within the next 'deadline date period' as per the 'Test' Sharepoint List below. I imagine this would use 'greater than or equal to' logic?  e.g. If email received on 21/08/20, and dates of 28/04/20, 24/09/20 & 30/10/20 are given in the Date column, the logic should choose 24/09/20 as the folder name. This is the next deadline date. 28/04 has already passed, and 30/10 is not the next earliest deadline. So I don't want to look up all dates greater than today, just the next nearest date. It's this date that should be the created folder name. On 25/09, this is a day after the 24/09 'cut-off'. The next deadline date is 30/10/20, so a new folder should be created with 30/10/20 as the folder name (when the next email w/ attachment is received)

    image.png

     

    2) In the concatenation, ...'/',triggerBody()?['From']) creates a subfolder within the created folder, with the name of the subfolder being the sender's email address.*

     

    • *Required change #2 - Instead, I want the name of this subfolder to be the sender's company name, taken from a Sharepoint List which will already contain the sender's email address (pre-populated, separate from Flow) Example below.

    image.png

     

    3) Move original email to a new folder. Hoping I can figure out this step myself. Though grateful for any help.


    Really appreciate any advice you can offer. Hopefully that's a bit more clear, now that there's a structure to it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 250 Super User 2026 Season 1

#2
Expiscornovus Profile Picture

Expiscornovus 222 Most Valuable Professional

#3
Haque Profile Picture

Haque 174

Last 30 days Overall leaderboard