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 / Flow when folder and f...
Power Automate
Answered

Flow when folder and file create on onedrive recreate the structure in sharepoint

(0) ShareShare
ReportReport
Posted on by 59

Hello, so the request is that a folder with a specific name will be created in sharepoint with a document inside, i want to see if its possible for Flow to detect that and then use the folder new to create a documentlibrary in a static sharepoint site and then also add the word document.

 

The flow would need to detect each time this happened in the onedrive.

 

Alternatively if i create a documentlibrary that stores word documents with FOLDERNAME - DOCNAME.docx could flow then detect the file is created in X library and use strings to create a new folder in Y site called FOLDERNAME then move the whole FOLDER - DOCNAME.docx to that folder automatically?

 

Thankyou

Categories:
  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @AndrewSmith84 ,

     

    Currently, Flow is unable to monitor whether a new folder has been created in OneDrive.

     

    For alternative methods, you could consider the configuration below.

    • Use an expression to get the FolderName and then create a new folder in the specified library.
    first(split(triggerBody()?['{Name}'],'-'))
    • Specify the path that the file needs to move in advance, and then use Move file action to move the specified file to the specified location.

    Image reference:

    7.PNG

    Hope it helps.

     

    Best Regards,

  • CU21081508-5 Profile Picture
    59 on at

    Thankyou @v-bacao-msft is this also possible from OneDrive?  So the files would be dropped to onedrive with FOLDERNAME - FILENAME.docx format and then the Flow would create a folder in sharepoint and drop the file in.

     

    Thanks

  • CU21081508-5 Profile Picture
    59 on at

    @v-bacao-msft it doesn't appear to work following your template.

     

    In AndrewTest1 sharepoint document library I dump a word file named FOLDER - NAME.docx and the Flow stops on Create new folder Output but no errors.

     

    Added my flow here: https://drive.google.com/file/d/1Xo9YW1KUZYdc5qDwUTTqPVSee-S5Zohj/view?usp=sharing

     

    Thankyou

  • CU21081508-5 Profile Picture
    59 on at

    Ok I managed to get the flow working but the flow fails on Move file unless I point it to the exact filename in File to move, this should be dynamic however when setting it as Identifier it fails.

     

    {
    "status": 400,
    "message": "Failed to verify the existence of source object at 'https://site.sharepoint.com/sites/Test/Shared Documents/TEST' due to error 'The system cannot find the file specified. (Exception from HRESULT: 0x80070002)'.\r\nclientRequestId: 78aa1a92-6cdc-4b7b-99d7-f3c5ec0f0483\r\nserviceRequestId: 78aa1a92-6cdc-4b7b-99d7-f3c5ec0f0483"
    }
     
    The documents the Flow should detect being created are here;
     
    https://site.sharepoint.com/sites/Test/MyTest1 and just stored in the roor document library not in any other folder.
     
    The output should create a folder here; 
     
    https://site.sharepoint.com/sites/Test2/MyTest2/ FOLDER then drop the full file in.
     
    Added a picture to show the Flow error.
     
    Untitled.png
  • CU21081508-5 Profile Picture
    59 on at

    can anyone else assist please?  thankyou

  • v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @AndrewSmith84 ,

     

    This is because the configuration of Destination Folder is incorrect.

    Here you need to include the file name, which is the relative path to the file, not the path to the folder it is in.

    So I integrated Folder path and Name into the path that makes up the file in Path.

    The result of my test here is fine.

     

    Best Regards,

  • CU21081508-5 Profile Picture
    59 on at

    @v-bacao-msft - Thankyou I have got it working now 🙂

     

    If I wanted to modify this so that I was copying the same file from OneDrive for Business to Sharepoint would that work?

     

    Thanks, 

  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @AndrewSmith84 ,

     

    If you want to copy files from OneDrive, you will need to make some changes.

    Please refer to the following image to improve Flow.

    89.PNG90.PNG

    Hope it helps.

     

    Best Regards,

  • CU21081508-5 Profile Picture
    59 on at

    Thankyou very much @v-bacao-msft 

  • CU21081508-5 Profile Picture
    59 on at

    @v-bacao-msft 

     

    Hello, is there anyway I could extend on this and create a second folder.

     

    So currently your suggested solution works and creates a folder from filename FOLDER-DOCUMENT.docx, creating folder named FOLDER then moving the file to that folder.

     

    However if I wanted to change the filename so it is FOLDER-SUBFOLDER-DOCUMENT.docx how would I go about this.

     

    I have tried a few variations but end up spawning too many folder or none at all with errors.  I assume I need to Compose and split the string properly.  The document will then be moved into the SUBFOLDER.

     

    Thankyou, Untitled.png

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard