Question

May I know how to make a copy of a SharePoint 2007 List library on the same site without saving as a template?

Example:

I have a SharePoint 2007 List library named 'Work Request' under a site called 'My Services'. I want to make a duplicate or clone or a copy of it and renamed it as 'Work Request Archive 2013' under the same site 'My Services'.

Was it helpful?

Solution

Other Methods:

  • Method 1

You can copy a list from one SharePoint site to another by exporting the list to a Windows SharePoint Services-compatible spreadsheet program such as Microsoft Office Excel 2003, and then importing the spreadsheet data into a the same site as a list. To copy a list using this method, you must have Microsoft Internet Explorer 5 or later installed.

When you export an Excel table to a SharePoint site, each column in a SharePoint list is assigned one of the following data types:

  • Text (single line)
  • Text (multiple lines)
  • Currency
  • Date/time
  • Number
  • Hyperlink

Therefore, calculated fields will not be copy and so you have to manual create the calculated fields and insert the formula manually.

The importing spreadsheet data can be found inside the Site Actions > Create, go to the Custom Lists column and select the Import Spreadsheet.

  • Method 2

Using PowerShell you can Export/Import

function Export-List([string]$ListURL)
{
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") > $null

    $versions = [Microsoft.SharePoint.Deployment.SPIncludeVersions]::All

    $exportObject = New-Object Microsoft.SharePoint.Deployment.SPExportObject
    $exportObject.Type = [Microsoft.SharePoint.Deployment.SPDeploymentObjectType]::List 
    $exportObject.IncludeDescendants = [Microsoft.SharePoint.Deployment.SPIncludeDescendants]::All

    $settings = New-Object Microsoft.SharePoint.Deployment.SPExportSettings

    $settings.ExportMethod = [Microsoft.SharePoint.Deployment.SPExportMethodType]::ExportAll
    $settings.IncludeVersions = $versions
    $settings.IncludeSecurity = [Microsoft.SharePoint.Deployment.SPIncludeSecurity]::All
    $settings.OverwriteExistingDataFile = 1
    $settings.ExcludeDependencies = $true

    $site = new-object Microsoft.SharePoint.SPSite($ListURL)
    Write-Host "ListURL", $ListURL

    $web = $site.OpenWeb()
    $list = $web.GetList($ListURL)

    $settings.SiteUrl = $web.Url
    $exportObject.Id = $list.ID
    $settings.FileLocation = "C:\Temp\BackupRestoreTemp\"
    $settings.BaseFileName = "ExportList-"+ $list.ID.ToString() +".DAT"
    $settings.FileCompression = 1

    Write-Host "FileLocation", $settings.FileLocation

    $settings.ExportObjects.Add($exportObject)

    $export = New-Object Microsoft.SharePoint.Deployment.SPExport($settings)
    $export.Run()

    $web.Dispose()
    $site.Dispose()
}

function Import-List([string]$DestWebURL, [string]$FileName, [string]$LogFilePath)
{
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") > $null

    $settings = New-Object Microsoft.SharePoint.Deployment.SPImportSettings

    $settings.IncludeSecurity = [Microsoft.SharePoint.Deployment.SPIncludeSecurity]::All
    $settings.UpdateVersions = [Microsoft.SharePoint.Deployment.SPUpdateVersions]::Overwrite 
    $settings.UserInfoDateTime = [Microsoft.SharePoint.Deployment.SPImportUserInfoDateTimeOption]::ImportAll

    $site = new-object Microsoft.SharePoint.SPSite($DestWebURL)
    Write-Host "DestWebURL", $DestWebURL

    $web = $site.OpenWeb()

    Write-Host "SPWeb", $web.Url

    $settings.SiteUrl = $web.Url
    $settings.WebUrl = $web.Url
    $settings.FileLocation = "C:\Temp\BackupRestoreTemp\"
    $settings.BaseFileName = $FileName
    $settings.LogFilePath = $LogFilePath
    $settings.FileCompression = 1

    Write-Host "FileLocation", $settings.FileLocation

    $import = New-Object Microsoft.SharePoint.Deployment.SPImport($settings)
    $import.Run()

    $web.Dispose()
    $site.Dispose()
}


    # For Export a specified SharePoint List
    Export-List "http://mySharePointWebApplication/sites/MySiteCollection/MyListToExport/" 

    # For Import the list you export in previous command
    Import-List "http://mySharePointWebApplication/sites/OtherSiteCollection/" "ExportList-TheGUID.DAT" "C:\Temp\BackupRestoreTemp\ImportLog.txt" 

Reference Link

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top