Add Composed Looks

21/11/2013 13:55

#Sets logo for web

param($webUrl, $themeName, $themeFileName, $displayOrder)

 

$web = Get-SPWeb $webUrl

$themeUrl = "/_catalogs/theme/15/" + $themeFileName

$composedLookList = $web.GetList($webUrl+"/_catalogs/design/")

$item = $composedLookList.AddItem();

"Adding item '{0}' to 'ComposedLooks'...'" -f $themeUrl

$item["Name"] = $themeName

$item["MasterPageUrl"] = $web.ServerRelativeUrl + "/_catalogs/masterpage/seattle.master"

$item["ThemeUrl"] = $web.ServerRelativeUrl + $themeUrl

$item["DisplayOrder"] = $displayOrder

$item.update()

$web.Update()

$file = $web.GetFile($web.ServerRelativeUrl + $themeUrl)

$theme = [Microsoft.SharePoint.Utilities.SPTheme]::Open($themeName, $file)

$theme.ApplyTo($web, $false)

$web.Dispose()