I'm trying to submit a file to OneDrive using BITS.
I found an article on this here: https://msdn.microsoft.com/en-us/library/dn858877.aspx; but I was hoping PowerShell's native Start-BitsTransfer
method could save me some effort. However that article implies that OneDrive supports BITS uploads; so things are promising.
$source = '\\myFileServer\Backups\SqlServerDbBackup.bak' #3.2GB file
$destination = 'https://myCompany.sharepoint.com/personal/my_account/Documents/SqlServerDbBackup.bak'
$cred = get-credential #here I enter the same credentials I use to access the site
Start-BitsTransfer -Source $source -Destination $destination -TransferType Upload -Credential $cred
When I run the above code the progress bar briefly pops up, then an error appears. Full output (including credentials prompt) below:
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Start-BitsTransfer : HTTP status 501: The server does not support the functionality required to fulfill the request.
At line:8 char:1
+ Start-BitsTransfer -Source $source -Destination $destination -TransferType Uploa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-BitsTransfer], Exception
+ FullyQualifiedErrorId : StartBitsTransferCOMException,Microsoft.BackgroundIntelligentTransfer.Management.NewBitsTransferCommand
Has anyone attempted this before / any ideas whether it's possible to perform an upload to OneDrive using start-bitstransfer
?