0

I'm using below script that actually create the News List in my SharePoint Online site, but I'm stuck on how to create different Column (Field) types under that List, right now it's just creating a Multiple lines of text Type field (NewsSum and NewsText). See the script below. I like to create DateTime type, Yes/No Choice Type, Multi Selection Type etc.. fields. Please guide.

$newsListName = "News"
Add-List -listTitle $newsListName
[string[][]]$fields =   ("NewsSum","Note",""),
                        ("NewsText","Note","")
Add-FieldsToList $fields $newsListName
  • Do you have any documentation how to find Add-List ? I can't see any such cmdlets in msdn. – Amal Hashim Jan 16 '15 at 16:54
  • Yup, it's right here, just add this module and you will get that sharepointpowershell.codeplex.com – ejagkrch Jan 16 '15 at 16:57
  • just download the above codeplex project, open the example file and search for "Create news list", I'm able to create this, but need to figure out how to create other types, if I change String to DateTime is says, Can Not convert the value NewsSum to System.DateTime. – ejagkrch Jan 16 '15 at 17:00
  • Ok I have found. Make sure the list is deleted before you create. See my answer. – Amal Hashim Jan 16 '15 at 17:02
0

The following are the supported FieldTypes you can use

Note
DateTime
Currency
Number
Choice
Person or Group
Calculated

Example

[string[][]]$fields = ("MyChoices","Choice","Left;Right"),("MyNumber","Number","")
  • wao, you the man. – ejagkrch Jan 16 '15 at 17:04
  • Thanks, Just one question, how I create a Single line Text, Like Title field, I can create Note, But I don't see that is supported? – ejagkrch Jan 16 '15 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.