Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Documentation issue for Copy-PnPFile regarding SharePoint to OneDrive capability #4037

Closed
EdAlexander opened this issue Jun 20, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@EdAlexander
Copy link

EdAlexander commented Jun 20, 2024

Reporting an Issue with documentation

Documentation for Copy-PnPFile states that copying files and folders between SharePoint libraries and OneDrive for Business is not possible but works fine in my environment. Is the documentation in error or out of date?

Expected behavior

According to the documentation at Copy-PnpFile Documentation this should not work.

From Description: " It is currently not possible to copy files between a OneDrive for Business site to SharePoint or vice versa"

Actual behavior

folder and contents are copied from SharePoint library to personal OneDrive in the specified target folder.

Steps to reproduce behavior

The following script is working in my environment.

$sourceSiteUrl = "https://tenant.sharepoint.com/sites/University"
$sourceRelativeSiteUrl = "/sites/University/Shared Documents/New Hire Onboarding"
$sourceLibrary = "Shared Documents"
$sourceFolder = "New Hire Onboarding"
$destinationSiteUrl = "https://tenant-my.sharepoint.com/personal/user_domain_com"
$destinationRelativeSiteUrl = "https://tenant-my.sharepoint.com/personal/user_domain_com/Documents/ArchiveTarget"
$destinationLibrary = "Documents"
$destinationFolder = "ArchiveTarget"
Connect-PnPOnline -Url $sourceSiteUrl -Interactive
$sourceConnection = Get-PnpConnection
$sourceCtx = Get-PnpContext
Set-PnPContext -Context $sourceCtx
$files = Get-PnPFolderItem -FolderSiteRelativeUrl "$sourceLibrary/$sourceFolder" -ItemType File -Connection $sourceConnection
$subFolders = Get-PnPFolderItem -FolderSiteRelativeUrl "$sourceLibrary/$sourceFolder" -ItemType Folder -Connection $sourceConnection
Copy-PnPFile -SourceUrl $sourceRelativeSiteUrl -TargetUrl $destinationRelativeSiteUrl -Overwrite -Force

What is the version of the Cmdlet module you are running?

2.4.0

Which operating system/environment are you running PnP PowerShell on?

Windows

@EdAlexander EdAlexander added the bug Something isn't working label Jun 20, 2024
@veronicageek veronicageek added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jun 22, 2024
@veronicageek veronicageek self-assigned this Jun 22, 2024
@veronicageek
Copy link
Collaborator

Thanks for raising this @EdAlexander - It does indeed work following a change we made in a previous version (issue #1720).
I've updated the documentation 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants