Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$sourceWebUrl = "http://adapt-proj-03:1515/pcf"
#This is the destination web, where the lists will be copied to
$destWebUrl = "http://adapt-proj-03:1515/"
#Location to store the export file
$path = "C:\Navneet\Site-Backup(1515)-1-6-15\ListBackup\"
#comma delimited list of List Names to copy
$lists = @("List1","List2","List3")
#Loop through the lists, export the list from the source, and import the list into the destination
foreach($list in $lists)
{
"Exporting " + $sourceWebUrl + "/lists/" + $list
Export-SPWeb $sourceWebUrl -ItemUrl ("lists/" + $list) -IncludeUserSecurity -IncludeVersions All -path ($path + $list + ".cmp")
"Exporting complete."
"Importing " + $destWebUrl + "/lists/" + $list
Import-SPWeb $destWebUrl -IncludeUserSecurity -path ($path + $list + ".cmp") -nologfile
"Importing Complete"
}
Some valuable information on SharePoint 2010,2013
Thursday, June 4, 2015
Exporting and Importing the Lists to other site or sub site or site in SharePoint through PowerShell
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment