1

I need to create one list with powershell with the following columns

Title Url (255 max length) Description (255 max length)

It must be a custom list. There is no need to create site columns or content type, just the list

1 Answer 1

7

I find it strange that you have done no basic research before posting this. Googling "create list powershell" will find you this post from heyscriptingguy, which should be what you need to get started.

PS > $listTemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList 
PS > $spListCollection = $spWeb.Lists 
PS > $spListCollection.Add("My Generic List","Description",$listTemplate)
PS > $spList = $spWeb.Lists["My Generic List"]
PS > $spFieldType = [Microsoft.SharePoint.SPFieldType]::Text 
PS > $spList.Fields.Add("TextField",$spFieldType,$false)
1
  • I think you've missed a line (assigning the list to $spList), +1 though as I found your script useful. Commented Dec 5, 2012 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.