Skip to content

Instantly share code, notes, and snippets.

@VenkateshKadiri66
Created December 18, 2017 09:39
Show Gist options
  • Select an option

  • Save VenkateshKadiri66/f0982110960e45829ef0b31b5563f2da to your computer and use it in GitHub Desktop.

Select an option

Save VenkateshKadiri66/f0982110960e45829ef0b31b5563f2da to your computer and use it in GitHub Desktop.
Creates a large list
#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
# Script settings
$webUrl = "http://weburl"
$listName = "Large List"
$numberOfItemsToCreate = 6000
$itemNamePrefix = "SWIFT "
# Open web and library
$web = Get-SPWeb $webUrl
$list = $web.Lists[$listName]
# Create desired number of items in subfolder
for($i=1; $i -le $numberOfItemsToCreate; $i++)
{
$newItemSuffix = $i.ToString("00000")
$newItem = $list.AddItem()
$newItem["Title"] = "$itemNamePrefix$newItemSuffix"
$newItem.Update()
write-host "Item created: $itemNamePrefix$newItemSuffix"
}
#Dispose web
$web.Dispose()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment