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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Organize Incoming Emai...
Power Automate
Unanswered

Organize Incoming Email Attachments by Year and Month

(0) ShareShare
ReportReport
Posted on by 2

I would like to create a Flow that:

1. Extracts an attachment from a shared mailbox email (Daily)

2. Creates a file on Sharepoint

3. Organizes the files based on Year and Month

4. Sends out an email with a shared link to the file

 

I have an existing flow that extracts the attachment, stores it in a folder and sends out the email with the shared link. However, the challenging part is now storing the files by year and month. For some reason the flow works, meaning that the files are stored by year and month and I get the email with the shared link, but for some reason the flow comes up as failed. 

 

Complete Flow.jpgYear Month Folder Creation.jpgOrganized File Created.jpg

 

When I ran the test, I renamed the initial Year folder that was created from 2023 to 203-old (and a similar test with month August to August-old) to see if it would create a new Year file. It did but it seems in part of the flow, 2023-old is being processed and creating an error. 

 

Error in FlowError in Flow

 

Thanks in advance everyone.

Categories:
I have the same question (0)
  • SamLed Profile Picture
    2,338 Moderator on at

    Hi,

     

    Here how I would have done this:

    SamLed_0-1692216196489.png

     

    Explicitly create folder before creating file, if folder already exists "Create new folder" won't complain and do nothing wrong, no need to check if it already exists. 

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

  • sdharam_netl Profile Picture
    2 on at

    Hi SamLed,

     

    Thanks for the suggestion. If I create the folder explicitly wouldn't that mean all the files will be stored in that folder and not relative to the month and year the file was created? Ideally I need a flow that would use the month and year the file was created and automatically place it in the relevant year and month folder. 

  • SamLed Profile Picture
    2,338 Moderator on at

    Come on, obviously you create the folder according to your dynamic contents, I set up like this to illustrate.

    ie. use formatDateTime(body('Get_items')?[Created], 'yyyy')/formatDateTime(body('Get_items')?[Created], 'MM')  

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 176 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 96 Super User 2026 Season 1

Last 30 days Overall leaderboard