Official Site
Microsoft Most Valuable Professional M365 Apps & Services
Microsoft Most Valuable Professional Business Applications
Consultant & Sr Cloud Solution Architect Modern Wokrplace

Find hereMore than 150 Articles about Microsoft Technologies on Modern Workplace
02 March 2024
In today's post I will show you how to easily copy items between libraris in a SharePoint site . First of all, note that this action can be done either by selecting from the front end and using the copy items action or by using PowerShell Here I should note that if we choose to transfer archives from one library to another some of the original data will not be transferred such as the original creator, the first time the record was uploaded, if it has been modified by a user. But the rest of the data like the versioning metadata can be transferred with the document With an active M365 subscription we can access the main page
Then we select the site in SharePoint and then the library of our choice
Then we select all the files we wish to transfer and press copy to in the options menu
I select the new library I want to transfer and press copy here
As you can see the transfer is complete but as I said before the modified by and creator data has not been passed to the archives
And of course, as I said before, the versions of the items have also been passed.
This process could also be completed using the following PowerShell
#Declare variable of site url
$site = "https://mytenant.sharepoint.com"
#Connect with SharePoint Online site 01
Connect-PnPOnline -Url $site -Interactive
# Copy Items Between Libraries
$allItems = Get-PnPListItem -List Documents
foreach ($item in $allItems) {
if ($item.FileSystemObjectType -eq "File"){
Copy-PnPFile -SourceUrl "$($item.FieldValues.FileRef)" -TargetUrl "/Demo" -Force
}
}
As you can finally see the execution of the above command does exactly the same action as the copy to
#ModerWork
#M365_Apps_Services
#BusinessApps
#SharePoint
#technology
#microsoft
#digitaltransformation
#cloud
#mvpbuzz
#m365
#PowerShell
#PnP
Visit Archives below to find more articles about Microsoft technologies on Modern Workplace