Creating A Custom List in Sharepoint
Okay, so now we’ve got our users and groups in place. Let’s start extending the Site a little. Starting off, let’s look at Custom Lists. Custom Lists are like excel sheets where we can store information in columns. There are lots of different types of data that we can store, such as: Single line of text, Choice, Numers, Date and Time, Lookup (Information already on the site) and so on.. So let’s start by creating a custom list.
When we create a new lisy of any kind, SharePoint needs to know what kind of list we want. If you check out the ListTemplates property you can see that there are many different types of lists that we can choose from.
PS > [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
PS > $SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $OpenWeb = $SpSite.OpenWeb(); $OpenWeb.ListTemplates | Select Name, Description; $OpenWeb.Dispose(); $SPSite.Dispose()
Name Description
---- -----------
Document Library Create a document library when you ha...
Form Library Create a form library when you have X...
Wiki Page Library Create a Wiki page library when you w...
Picture Library Create a picture library when you hav...
Links Create a links list when you have lin...
Announcements Create an announcements list when you...
Contacts Create a contacts list when you want ...
Calendar Create a calendar list when you want ...
Discussion Board Create a discussion board when you wa...
Tasks Create a tasks list when you want to ...
Project Tasks Create a project tasks list when you ...
Issue Tracking Create an issue tracking list when yo...
Custom List Create a custom list when you want to...
Custom List in Datasheet View Create a custom list when you want to...
Survey Create a survey when you want to poll...
Workflow History This list is used by SharePoint to st...
Custom Workflow Process Custom Workflow Process tracking list...
No Code Workflows Gallery for storing No Code Workflows...
DataSources Gallery for storing data source defin...
In our case, we’ll use the Custom List. The Strings that are defined are: Title and Description. TemplateType is an object that we have to create around the specific template that we want to use.
PS > $SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $OpenWeb = $SpSite.OpenWeb(); $TemplateType = $OpenWeb.ListTemplates["Custom List"]; $OpenWeb.Dispose(); $SPSite.Dispose()
PS > $SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $OpenWeb = $SpSite.OpenWeb(); $OpenWeb.Lists.Add("My Custom List","Description Of My Custom List",$TemplateType); $OpenWeb.Dispose(); $SPSite.Dispose()
If we Check out our Site now, we will have a new “Custom” list added.

[?]
