Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [2.24.1803.0 - Unreleased]
### Added
- Added Set-PnPWebTheme
- Added Invoke-PnPSiteDesign
- Added Read-PnPProvisioningTemplate [Rename: see deprecated section]
- Added Invoke-PnPQuery [Rename: see deprecated section]
Expand Down
41 changes: 41 additions & 0 deletions Commands/Branding/SetWebTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#if !ONPREMISES
using System;
using System.Management.Automation;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using SharePointPnP.PowerShell.CmdletHelpAttributes;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using SharePointPnP.PowerShell.Commands.Utilities;

namespace SharePointPnP.PowerShell.Commands.Branding
{
[Cmdlet(VerbsCommon.Set, "PnPWebTheme")]
[CmdletHelp("Sets the theme of the current web.", DetailedDescription = "Sets the theme of the current web. * Requires Tenant Administration Rights *", Category = CmdletHelpCategory.Branding, SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Code = @"PS:> Set-PnPWebTheme -Theme MyTheme",
Remarks = @"Sets the theme named ""MyTheme"" to the current web",
SortOrder = 1)]
[CmdletExample(
Code = @"PS:> Get-PnPTenantTheme -Name ""MyTheme"" | Set-PnPTheme",
Remarks = @"Sets the theme named ""MyTheme"" to the current web",
SortOrder = 2)]
public class SetWebTheme : PnPWebCmdlet
{
[Parameter(Mandatory = false, Position = 0, ValueFromPipeline = true, HelpMessage = "Specifies the Color Palette Url based on the site or server relative url")]
public ThemePipeBind Theme;

protected override void ExecuteCmdlet()
{
var url = SelectedWeb.EnsureProperty(w => w.Url);
var tenantUrl = UrlUtilities.GetTenantAdministrationUrl(ClientContext.Url);
using (var tenantContext = ClientContext.Clone(tenantUrl))
{
var tenant = new Tenant(tenantContext);

tenant.SetWebTheme(Theme.Name, url);
tenantContext.ExecuteQueryRetry();
}
}
}
}
#endif
1 change: 0 additions & 1 deletion Commands/Graph/GetUnifiedGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using SharePointPnP.PowerShell.Commands.Base;
using SharePointPnP.PowerShell.Commands.Base.PipeBinds;
using SharePointPnP.PowerShell.Commands.Model;
using SharePointPnP.PowerShell.Commands.Utilities.REST;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
1 change: 1 addition & 0 deletions Commands/SharePointPnP.PowerShell.Commands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@
<Compile Include="Base\PipeBinds\TenantSiteScriptPipeBind.cs" />
<Compile Include="Base\PipeBinds\TenantSiteDesignPipeBind.cs" />
<Compile Include="Branding\GetNavigationNode.cs" />
<Compile Include="Branding\SetWebTheme.cs" />
<Compile Include="ClientSidePages\GetClientSideComponent.cs" />
<Compile Include="ClientSidePages\RemoveClientSideComponent.cs" />
<Compile Include="ClientSidePages\MoveClientSideComponent.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Commands/SiteDesigns/InvokeSiteDesign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace SharePointPnP.PowerShell.Commands
{
[Cmdlet(VerbsLifecycle.Invoke, "PnPSiteDesign", SupportsShouldProcess = true)]
[CmdletHelp(@"Apply a Site Design to an existing site.",
[CmdletHelp(@"Apply a Site Design to an existing site. * Requires Tenant Administration Rights *",
Category = CmdletHelpCategory.TenantAdmin,
SupportedPlatform = CmdletSupportedPlatform.Online)]
[CmdletExample(
Expand Down