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 / Dynamic folder structure
Power Automate
Unanswered

Dynamic folder structure

(0) ShareShare
ReportReport
Posted on by 2,249

Kindly help me for dynamic folder structure for file creation for documents attachment from the emailbox

 

Document Library

Year-month-country-new/renewal/withdraw/approve

Categories:
I have the same question (0)
  • Veblitz Profile Picture
    2,249 on at

    attachments in the email needs to extracted and to be stored in predefined folder structure such as 

    predefined folder structure:(document library structure to store attachments from email)

    year/month/country/client/new

    year/month/country/client/renewal

    year/month/country/client/Approval

    year/month/country/client/Completed

     

    Note: Year,month,country,client,new,renewal,approval,completed should be determined based on the attachment which is dynamic in nature and to copy the attachment accordingly 

     

    Example 1:

    If attachment in the email is 2024/06/usa/Microsoft/new then it should pick the file and store to the respective folder

    Example 2:

    If attachment in the email is 2024/05/UK/xxx/renewal then it should place the file in respective folder

     

     

  • Veblitz Profile Picture
    2,249 on at

    i achived by hardcoding in my flow but im not sure how to copy attachments to predefined or to create dynamically for the above structure formats for email attachments to document library.

  • Veblitz Profile Picture
    2,249 on at

    1.when a new email arrives(V3)--options details are Inbox folder selected;only with attachments-yes

    2.HTML to text->Body

    3.compose 2 blank space

    4.compose 3-split(outputs('Html_to_text')?['body'],outputs('Compose_2'))

    5.Initialize variable-subfolders array

    6.Initialize variable-varcountry ,Type-string,value-last(split(outputs('Compose_3')[2],':'))

    7.Initialize variable 2-varclient ,Type-string,value-last(split(outputs('Compose_3')[2],':'))

    8.conditions
    or --- operation
    subject contains new
    subject contains renewal
    subject contains approval
    subject contains completed

    yes(branch)

    Applytoeach
    select an output-attachments
    get attachments-
    messageid:MessageID
    AttachmentID-Attachment

    Create sharepoint item for Year folder
    Create sharepoint item for month folder
    Create sharepoint item for country folder
    create sharepoint item for customer folder

    set variable
    Name:subfolders
    Value:["new",]

    apply to each
    select an output-subfolders
    create new folder

    case equals new 
    apply to each
    select an output-attachments
    get attachment v2
    messageid- messageid
    attachmentid-attachment
    Apply to each
    create file

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard