How to move list items(+2500 items) from the original list to another list(Archive)? Any ideas appreciated.
3 Answers
You have tree options to do:
Solution 1- Using content and structure page to move files with version and metadata:
Go to Site setting-->Click 'Content and Structure' link under Administration section Pick the items/files to be moved, Click on Actions >> Move Select the target list or library and click "OK" to complete move operation.
Solution 2- Move files between document libraries programmatically using Power Shell:
#For MOSS 2007 compatibility
[void]
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb();
}
return $web
}
#Get the web and List
$Web = Get-SPWeb "<a class="vglnk"
href="http://intranet.sharepoint.com/sites/Marketing/" rel="nofollow">
<span>http</span><span>://</span><span>intranet</span><span>.</span>
<span>sharepoint</span><span>.</span><span>com</span><span>/</span>
<span>sites</span><span>/</span><span>Marketing</span><span>/</span></a>"
$SourceList = $web.Lists["Proposals"]
$TargetList = $Web.Lists["Proposal Archive 2009"]
#Get all Files Created in 2009
$Query = '<Where><And><Geq><FieldRef Name="Created" /><Value
IncludeTimeValue="TRUE" Type="DateTime">2009-01-01T00:00:00Z</Value></Geq>
<Leq><FieldRef Name="Created" /><Value IncludeTimeValue="TRUE"
Type="DateTime">2009-12-31T23:59:59Z</Value></Leq></And></Where>'
$SPQuery = new-object Microsoft.SharePoint.SPQuery
#$SPQuery.ViewAttributes = "Scope='Recursive'" #To include Sub-folders in
the library
$SPQuery.Query = $Query
$SourceFilesCollection =$SourceList.GetItems($SPQuery)
Write-host "Total number of files found: "$SourceFilesCollection.count
#Move each file to the destination folder
foreach($item in $SourceFilesCollection)
{
#Get the Source File
$file = $Web.GetFile($item.File.URL)
#Get the Month value from the File crated date
$MonthValue = $item.File.TimeCreated.ToString('MMMM')
# Try to Get the Sub-Folder in the Library!
$TargetFolder = $TargetList.ParentWeb.GetFolder($TargetList.RootFolder.Url
+ "/" +$MonthValue);
#If the folder doesn't exists, Create!
if ($TargetFolder.Exists -eq $false)
{
$TargetFolder = $TargetList.Folders.Add("",
[Microsoft.SharePoint.SPFileSystemObjectType]::Folder, $MonthValue)
$TargetFolder.Update()
}
#Move the File
$file.MoveTo($TargetFolder.Url + "/" + $File.name)
}
Solution 3: Move files using SharePoint designer
• Open your site in SharePoint Designer
• Go to All Files >> Navigate to source library. Select files you want to copy/move, choose cut/copy
Go to your target library, Right click and choose "Paste"
SharePoint's Content and structure page includes a Move-tool which can be used with list items. By using Content and structure, you can multi-select items and perform them the same action at once.
To access Content and structure, go to Site settings > below Site Administration -category, open Content and structure.
You can use List back-up a template and later create a new list using this template. Goto List Settings -> Save this List as a template -> check Include Contents -> OK
now you can create a new list using this template. GoTo Site Contents -> Add an App -> Select your list template -> OK