cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndrewSmith84
Helper I
Helper I

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

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

1 ACCEPTED SOLUTION

Accepted Solutions

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-bacao-msft
Community Support
Community Support

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

@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

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

can anyone else assist please?  thankyou

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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, 

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thankyou very much @v-bacao-msft 

@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

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (4,728)