copy file from onedrive to sharepoint with powershell or automate

豬肉榮 1 Reputation point
2023-03-05T09:23:07.92+00:00

Hi , Everyone

This is what my boss want to do .........copy one account's onedrive file (almost 3TB) to specify sharepoint site , now , I found three methods .

First : login user onedrive , use "Copy to" function to copy file to sharepoint site , but the poor performance is not acceptable .

Second : use power automate , in oder to face user's file hierarchy , now I still study how to achieve this goal . if user's onedrive only one level file , I think I can achieve it !

Third : user powershell ......about this issue , I still studying ~~~

So , could everyone give me some guides to get my boss need !!!

Microsoft 365 and Office SharePoint For business Windows
Microsoft 365 and Office OneDrive For business Windows
{count} votes

2 answers

Sort by: Most helpful
  1. 豬肉榮 1 Reputation point
    2023-03-06T01:11:10.3866667+00:00

    Thanks !

    I will test today on office


  2. Omar Mallat 0 Reputation points
    2024-01-29T07:13:30.81+00:00

    Hi. the Copy-PnPFile was lacking the full functionality to allow copying from OneDrive to SharePoint and vice versa. Recently, they confirmed the mobile PnP.Powershell has been upgraded with the solution for this. and I used it and it worked as expected, however my case was from SharePoint to OneDrive based on that, and assuming that you have access to both locations:

    Install-Module pnp.powershell
    Import-Module pnp.powershell
    $SourceConn = Connect-PnPOnline -URL $SourceSiteURL -Interactive -ReturnConnection
    Copy-PnPFile -Connection $SourceConn -SourceUrl $f.ServerRelativeUrl -TargetUrl $DestinationLibraryURL -Force -OverwriteIfAlreadyExists
    

    SourceURL is a relative path that start with: /Documents/....Target URL is a full path TargetUrl is a full path like https://MYTENANT.sharepoint.com/sites/SITENAME/Shared%20Documents/MYFOLDER

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.