Advertisement
In this post we are going to see how to create Custom List from Power Shell in SharePoint 2013.
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
$spListCollection=$spWeb.Lists
#adding the new list to the list collection
$spListCollection.Add("Studentlist","Studentlist",$spTemplate)
#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
$spList.Fields.Add("SNo",$spFieldType,$false)
#adding the field type(Text) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("SName",$spFieldType,$false)
#adding the field type(choice) to the list
$choices = New-Object System.Collections.Specialized.StringCollection
$choices.Add("Female")
$choices.Add("Male")
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Choice
$spList.Fields.Add("Gender",$spFieldType,$false,$false,$choices)
#adding the field type(url) to the list
$spList.Fields.Add("Photo","URL",$false)
$Views = $spList.Views["All Items"]
$Views.ViewFields.Add("SNo")
$Views.ViewFields.Add("SName")
$Views.ViewFields.Add("Gender")
$Views.ViewFields.Add("Photo")
$Views.Update()
How to add fields to list in sharepoint using powershell - See more at: http://www.dotnetsharepoint.com/#sthash.vM7z4E6E.dpuf
How to add fields to list in sharepoint using powershellCopy 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
$spListCollection=$spWeb.Lists
#adding the new list to the list collection
$spListCollection.Add("Studentlist","Studentlist",$spTemplate)
#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
$spList.Fields.Add("SNo",$spFieldType,$false)
#adding the field type(Text) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("SName",$spFieldType,$false)
#adding the field type(choice) to the list
$choices = New-Object System.Collections.Specialized.StringCollection
$choices.Add("Female")
$choices.Add("Male")
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Choice
$spList.Fields.Add("Gender",$spFieldType,$false,$false,$choices)
#adding the field type(url) to the list
$spList.Fields.Add("Photo","URL",$false)
$Views = $spList.Views["All Items"]
$Views.ViewFields.Add("SNo")
$Views.ViewFields.Add("SName")
$Views.ViewFields.Add("Gender")
$Views.ViewFields.Add("Photo")
$Views.Update()
0 comments:
Post a Comment