Script to Generate 25000 items in one list

sns 9,236 Reputation points
2020-11-08T10:15:20.237+00:00

I need a script to Generate 25000 items in one list for my sharepoint online site.

Please help.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,827 questions
0 comments No comments
{count} votes

Accepted answer
  1. Emily Du-MSFT 47,301 Reputation points Microsoft Vendor
    2020-11-09T07:14:35.567+00:00

    @sns
    You could try to use below PnP PowerShell to add 25000 items in the SharePoint list.

    $username = "user name "  
    $password = "password"  
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)  
    Connect-PnPOnline -Url site collection URL -Credentials $cred  
    $ListName ="list name"  
     for($i=0;$i –lt 25001;$i++){  
    Add-PnPListItem -List $ListName -Values @{"Title" = "test";}      
    }  
    

    I’d like to explain that in SharePoint Online we have a list view threshold limit which is 5000. To learn more, see SharePoint Online software boundaries and limits. When we exceed this limit, it will cause some unexpected behaviors and performance issues. So, we suggest users manage large list referring to the article below:
    Manage large lists and libraries in Office 365


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.