Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have around 50,000 items in sharepoint list . I want to increase the size of the list items to 90,000 . It is ok to have duplicate enteries . How do i do it with minimal time ?

Its ok if i paste the same data in the list .

share|improve this question
    
Unless these are in folders, you are really pushing the limits of what SharePoint should be doing with a list. You may want to consider alternative options such as a proper database application. –  Aboba Jul 31 at 15:52
    
Yes i do have a folder structure for the list . –  Nikhil Jul 31 at 16:20
    
You can have duplicate entries (it assigns each entry a unique ID anyways). I'm not sure why you would want to re-paste the same data, but yes you can do that and using datasheet view is the fastest method short of code. –  Aboba Jul 31 at 16:44
    
I want to test performance of app with having large data in list . I know i can write a PS and get it done . But is there a easy way ? –  Nikhil Jul 31 at 16:45
    
I'm not a PS junkie, so I would use a little javascript to write entries in a loop. Would it be faster? I have no idea. –  Aboba Jul 31 at 16:51

1 Answer 1

up vote 0 down vote accepted

Powershell Script to dump all the folders in same list and increase the size from 50K to 90K.

function Copy-ItemsToFolder([Microsoft.SharePoint.SPFolder]$folder, $srcList, $destList)
{
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$spQuery.Folder = $folder


$sourceSPListItemCollection = $srcList.GetItems($spQuery);
$destFolder = $destList.Folders[$folder.Name];
if ($destFolder -eq $null -or $destFolder -eq "")
{
    #folder does not exist so create it.
    $destFolder = $destList.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder)
    $destFolder["Title"] = $folder.Name + "_3";
    $destFolder.Update()
}
$count = $sourceSPListItemCollection.Count;
$index = 0;
$newFolderPath = $destFolder.Folder.ServerRelativeUrl
foreach($srcListItem in $sourceSPListItemCollection)
{
    $index++;

    write-host "adding new item $index of $count";
    $newSPListItem = $destList.AddItem($newFolderPath, [Microsoft.SharePoint.SPFileSystemObjectType]::File, $null);

    foreach($spField in $srcListItem.Fields)
    {
        if ($spField.ReadOnlyField -ne $True -and $spField.InternalName -ne "Attachments")
        {
            $newSPListItem[$spField.InternalName] = $srcListItem[$spField.InternalName];
        }
    }
    $newSPListItem.Update()
    write-host "added";
}
}
try
{
$srcListSiteUrl = "https://sitename/abc/"
$SourceListName = "lsitname"

$dstListSiteUrl = "https://sitename/abc/"
$DestinationListName = "lsitname"

$keyColumnInternalName = "Title"

$sourceListWeb = Get-SPWeb -identity $srcListSiteUrl
$sourceListUrl = $sourceListWeb.ServerRelativeUrl + "/lists/" + $SourceListName;

$dstListWeb = Get-SPWeb -identity $dstListSiteUrl
$destinationListUrl = $dstListWeb.ServerRelativeUrl + "/lists/" + $DestinationListName;

$SourceList = $sourceListWeb.GetList($sourceListUrl);
$DestinationList = $dstListWeb.GetList($destinationListUrl);

foreach($currentFolder in $SourceList.RootFolder.SubFolders)
{
    Write-Host "processing folder $($currentFolder.Name)";

    if ($currentFolder.ItemCount -gt 0)
    {
        Copy-ItemsToFolder $currentFolder $SourceList $DestinationList
    }
    Write-Host "done with folder"
}

}

catch
{
write-host $_.exception
}

finally
{
if($sourceListWeb -ne $null){$sourceListWeb.Dispose()}
if($dstListWeb -ne $null){$dstListWeb.Dispose()}
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.