Quantcast
Channel: Engage In SharePoint » lists
Viewing all articles
Browse latest Browse all 3

SharePoint 2010 Powershell Series – Creating Lists

$
0
0

Last time we looked at creating sites and now I have looked at how we go about creating a set of lists for that site.

# This will populate the variable with the SPWeb object so you can make use of it
$web = Get-SPWeb http://mysiteurl
# This will add a new announcement list
# The format is (listname, listdescription, listtype)
$web.Lists.Add("Announcements", site announcements list", 104)
# This will add a new links list
$web.Lists.Add("Links", "site links list", 103)

You will see that the last parameter for adding both the announcements and links list is a number.
This number relates to a Template Type as specified on the Microsoft site.
As with a lot of things there may be a better way of selecting the template type but for now I am happy using the Microsoft site as a reference.
Next time I will look at creating a loop and iterating through to create 10 sites and associated lists.


Viewing all articles
Browse latest Browse all 3

Trending Articles