So I have powershell code to upload a palette file to my themes gallery but I cannot seem to figure out how to create the composed look in the composed look gallery using the link to my uploaded theme in sharepoint 2016/2013 in powershell, any suggestions?
Here is my current code:
If(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0)){
Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell"
Add-PSSnapin Microsoft.SharePoint.PowerShell
}
cls
$web = get-spweb http://test.site.com
<# Create composed look start #>
foreach($site in $web.Site.Allwebs)
{
<# Upload Palette to Themes Gallery in rootsite Start #>
try
{
$rootWeb = get-spweb $site.Site.RootWeb.Url
$DocLibName = “_catalogs/theme” #Themes Library Name
$FilePath = “C:\temp\colorPalette.spcolor” #Local path to palette file
$List = $rootWeb.GetFolder($DocLibName)
$Files = $List.Files
$FileName = $FilePath.Substring($FilePath.LastIndexOf("\")+1)
# Load the file into a variable
$File= Get-ChildItem $FilePath
# Upload it to SharePoint
$Files.Add($DocLibName +"/" + $FileName,$File.OpenRead(),$false)
}
catch
{
#
}
<# Upload Palette to Themes Gallery in rootsite End #>
<# Verify Site not root site Start #>
if($site.Url -ne $site.Site.RootWeb.Url)
{
$paletteUrl = $site.Site.RootWeb.Url + "/_catalogs/theme"
$paletteUrl
$compositeLookGallery = $site.GetCatalog(124)
#$site.Load($compositeLookGallery)
$spContext = New-Object Microsoft.SharePoint.Client.ClientContext($site.Url);
}
<# Verify Site not root site End #>
}
<# Create composed look End #>