PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWebs
SharePoint + PowerShell User Group
November 21, 2012
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Agenda
• Hello!• Group Logistics (GoToMeeting/ website /
register / email / twitter)• SPSite & SPWeb• Useful Scripts• Next meeting• SURVEY!!!
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Survey
• Excel Survey (via SkyDrive)– http://sdrv.ms/T49Afu
More info on Excel Surveys– http://
blogs.office.com/b/microsoft-excel/archive/2012/11/16/excel-surveys.aspx
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Raymond Mitchell• SharePoint Consultant
– http://www.Rackspace.com• Author• Dad• Information Worker Kid
– http://www.iwkid.com• SharePoSHing since 2008
Hello!
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
What about you?
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• SPSite = Site Collection
• SPWeb = Web Site
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Get-SPSite– Shows 20 by default– Use -Limit ALL to show all– Can limit by URL, Content Database, Web
Application
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Find SPSite Properties
$site | gm | ? {$_.Definition.ToLower().Contains("database") } | ft
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• ContentDatabase• Owner• RecycleBin SPRecycleBinItemCollection
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Site Collections are a containment object– SPWebCollection– Galleries• Web Parts• Site Columns• Content Types• List/Web Templates
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• GetCatalog(SPListTemplateType)– WebTemplateCatalogSite template gallery. Value = 111.– WebPartCatalogWeb Part gallery. Value = 113.– ListTemplateCatalogList Template gallery. Value = 114.– MasterPageCatalogMaster Page gallery. Value = 116.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• GetCustomListTemplates• GetCustomWebTemplates
• GetWebTemplates(LCID)
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Creating a new SPSite
New-SPSite -url ... -OwnerAlias ... -Name ... -Template ...
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• SPSite = Site Collection
• SPWeb = Web Site
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• SPSite.RootWeb• SPSite.AllWebs
• Get-SPWeb– By URL– By SPSite
• By Filter:
$site | Get-SPWeb -filter {$_.Template -eq "STS#1"}
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Lists• Folders / Files• Navigation– QuickLaunch– TopNavigationBar
• TreeViewEnabled• RecycleBin• IsRootWeb• WebTemplate, WebTemplateId
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• ListTemplates• WorkflowTemplates
• AvailableContentTypes vs ContentTypes• AvailableFields vs Fields
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Properties (SPPropertyBag)vs
AllProperties (Hashtable)
– Use AllProperties!– AddProperty()– DeleteProperty()
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Groups (only those with assigned permissions)• SiteGroups (all groups)• Users• SiteUsers
• Roles (obsolete)• RoleDefinitions• RoleAssignments
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
SPSite & SPWeb
• Creating a new SPWeb
New-SPWeb http://localhost/test - Template "STS#0"
http://technet.microsoft.com/en-us/library/ff607579.aspx
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
YOUR scripts!
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
YOUR scripts!
• Jason Himmelstein (@sharepointlhorn)– Automatically log your PowerShell session every
time– http://
www.sharepointlonghorn.com/Lists/Posts/Post.aspx?ID=78
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Next Meeting
• Wednesday, December 19th
• SharePoint Solutions & Features• Matthias Einig (@mattein)
SharePoint Solution Deployerhttp://spsd.codeplex.com
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Resources
• PowerShell + SharePoint forum at PowerShell.org:– http://
powershell.org/discuss/viewforum.php?f=12• PowerShell Summit: April 22-24
http://powershell.org/summit
PS SharePoSH:\>
http://www.SharePoSH.com @SharePoSH
Survey
• Excel Survey (via SkyDrive)– http://sdrv.ms/T49Afu
More info on Excel Surveys– http://
blogs.office.com/b/microsoft-excel/archive/2012/11/16/excel-surveys.aspx