May 17 2017 12:15 PM
I am trying to upload a file (actually copy a file from a SP site) to the default Documents list in OneDrive for Business but the Copy-PnPFile -SourceUrl $source -TargetUrl $target cmdlet is expecting a relative path versus an absolute path to https://tenant-my.sharepoint.com …
Unfortunately I have not been able to find any PowerShell examples that can upload a file to OneDrive. Is it even possible?
Tim
May 17 2017 02:03 PM
May 17 2017 03:44 PM
Thank you. Vesa also pointed me to the fact that I could connect to the OD4B site directly using the connect-pnponline PnP cmdlet and then use the Add-PnPFile cmdlet to upload the file.
connect-pnponline -Url $OneDriveURL –Credentials (Get-Credential)
Add-PnPFile -Path $Source -Folder "Documents" -Values @{Modified="5/1/2017"}
https://github.com/SharePoint/PnP-PowerShell/blob/master/Documentation/AddPnPFile.md