Created
December 18, 2017 09:39
-
-
Save VenkateshKadiri66/f0982110960e45829ef0b31b5563f2da to your computer and use it in GitHub Desktop.
Creates a large list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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