How to create List using Power shell Script in SharePoint 2013

In this post we are going to see how to create Custom List from Power Shell in SharePoint 2013.
How to add fields to list in sharepoint using powershell - See more at:
How to add fields to list in sharepoint using powershell
Copy value from one filed to another field using PowerShell
Add X years to date column based on item created date in SharePoint PowerShell
How to import users from CSV to SharePoint site using PowerShell
How to update the modified by using power shell
How to add column in to List using Power Shell
Date formula in SharePoint calculated value

Create a SharePoint Custom List  Student Info with Columns
SNo    -  Number
SName  -  Text
Gender -  Choice
Photo  -  URL

#To which site u want to create the list
$spWeb=Get-SPWeb -Identity http://c4968397007

#List type or template
$spTemplate = $spWeb.ListTemplates["Custom List"]

#Get all the lists to the listcollection

#adding the new list to the list collection

#get the path of subsite and sitecollecion
$path = $spWeb.url.trim()

#get the list to the list object
$spList = $spWeb.GetList("$path/Lists/Studentlist")

#adding the field type(Number) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Number

#adding the field type(Text) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text

#adding the field type(choice) to the list
$choices = New-Object System.Collections.Specialized.StringCollection
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Choice

#adding the field type(url) to the list

$Views = $spList.Views["All Items"]



  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment


Post a Comment