Skip to content

Enable Copy-PnPFile / Move-PnpFile to transfer between Odfb and SPO #620

Discussion options

You must be logged in to vote

I dont think this is currently possible with Copy-PnPFile or Move-PnP file and I suspect this is due to authentication.

The way I've had to do it in the past which is a little clunky but works (see example below you could adapt).

Is connecting to the OneDrive site, assigning the file to a Stream variable and then connecting to the SP Site and then using it with Add-PnPfile.

#Connect To OneDrive
Connect-PnPOnline -Url 'https://tenantname-my.sharepoint.com/personal/username'

#Add the file to Stream Variable
$streamResult = (Get-PnPFile -Url '/personal/username/Documents/Certs/ReportsApp.cer').OpenBinaryStream()
Invoke-PnPQuery # this is will load the clientresult object returned from OpenB…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@colonelclaypoo
Comment options

@omarmallat
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by colonelclaypoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants