cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marvilicious
Regular Visitor

Move files in folder from OneDrive to Sharepoint into a newly created folder

Hi, 

I couldn't find a solution to this anywhere.

I want to do the following with PowerAutomate: Every month, move all files from a specified folder in OneDrive to a folder in SharePoint that is then created and named based on the current month an year.

 

I am new to this. Any help is appreciated. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User III
Super User III

@marvilicious 

Please see my example below and let me know if you have any questions.  The expression that I used in the Compose action can be found in the comments are.

MoveFile1.jpg

MoveFile2.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

6 REPLIES 6
CFernandes
Super User III
Super User III

@marvilicious 

 

My solution:

 

CFernandes_1-1598890609186.png

 

In the Create Action, File Name I have used the Formula, 

 

concat(formatDateTime(utcNow(),'MM'),outputs('Compose'))

 

The Compose action hold the 'Name' Property the output of 'List files in Folder' action.

 

Output in SharePoint it add the current Month number at the start.

 

CFernandes_2-1598890784730.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

 

 

@CFernandes Thanks a lot for the quick reply.

 

Two questions regarding this:

  • Instead of adding the month to the files that are moved, I would like the name of the new SharePoint folder to be "MM-yyyy". How do I do that?
  • In the Create Action on SharePoint, what do I put in the "Folder path" so it finds the correct new folder?

Best

ScottShearer
Super User III
Super User III

@marvilicious 

Please see my example below and let me know if you have any questions.  The expression that I used in the Compose action can be found in the comments are.

MoveFile1.jpg

MoveFile2.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

@ScottShearer Great, thank you, this works! Even though the run history shows that the flow has failed due to a bad request at the "Create file" command. Error details: Root folder is not found. But all files are in a correctly named folder.

 

One small thing I had to change: in the "Create file" part the path needs to be "/Documents/..."

 

Also: Since I originally wanted to move the files, how do you delete the files in the OneDrive folder. For now it's only copying and then the files are both in the original OneDrive folder as well as the SharePoint.

 

Best

@marvilicious 

I'm glad this worked for you!

To delete the OneDrive files, add a OneDrive for Business Delete File action after the SharePoint Create File action inside of the loop.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

@ScottShearer 

 

Hi again,

I now got an error message with this flow for every single file that is supposed to be created in the new folder. Please see below. Could you clarify what is going wrong? 

 

marvilicious_0-1601457861488.png

 

Thanks a lot!

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (50,518)