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

Notifications

Announcements

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

Forum hierarchy changes are complete!

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

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard