You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/declarative-customization/site-theming/sharepoint-site-theming-powershell.md
+33-29Lines changed: 33 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,19 @@
1
1
# SharePoint site theming: PowerShell commands
2
2
3
-
Tenant administrators can use the PowerShell commands covered below to create, retrieve, and remove site themes. Note that developers can also use the SharePoint [REST API](sharepoint-site-theming-rest-api.md) to handle theme management tasks.
3
+
<!-- Global: We should refer to PowerShell "cmdlets" instead of "commands", to be consistent with the admin docs on TechNet. -->
4
+
5
+
SharePoint tenant administrators can use PowerShell commands to create, retrieve, and remove site themes. Developers can also use the SharePoint [REST API](sharepoint-site-theming-rest-api.md) to handle theme management tasks.
4
6
5
7
For information about how themes are defined and stored, see [JSON schema reference](sharepoint-site-theming-json-schema.md).
6
8
7
9
## Getting started
8
10
9
-
To run the PowerShell commands for theme management you'll need to download and install the SharePoint Online Management Shell and then connect to your SharePoint tenant from within the shell:
11
+
To run the PowerShell commands for theme management, you'll need to download and install the SharePoint Online Management Shell, and then connect to your SharePoint tenant from within the shell:
10
12
11
-
* Download and install the SharePoint Online Management Shell from this page: [https://www.microsoft.com/en-us/download/details.aspx?id=35588](https://www.microsoft.com/en-us/download/details.aspx?id=35588). If you already have a previous of the shell installed, un-install it first and then install the latest version from the link.
12
-
* After the shell is installed, follow the instructions at [Connect to SharePoint Online PowerShell](https://technet.microsoft.com/en-us/library/fp161372.aspx) to connect to your SharePoint tenant.
13
+
1. Download and install the [SharePoint Online Management Shell](https://www.microsoft.com/en-us/download/details.aspx?id=35588). If you already have a previous version of the shell installed, uninstall it first and then install the latest version.
14
+
2. After the shell is installed, follow the instructions at [Connect to SharePoint Online PowerShell](https://technet.microsoft.com/en-us/library/fp161372.aspx) to connect to your SharePoint tenant.
13
15
14
-
To verify your setup, try using the Get-HideDefaultThemes command to read the HideDefaultThemes setting. If it runs and returns False with no errors as shown below, you're ready to proceed.
16
+
To verify your setup, try using the **Get-HideDefaultThemes** command to read the HideDefaultThemes setting. If the command runs and returns False with no errors, as shown in the following example, you're ready to proceed.
15
17
16
18
```powershell
17
19
c:\> Get-HideDefaultThemes
@@ -21,19 +23,17 @@ False
21
23
22
24
The following commands are available for managing site themes from PowerShell:
23
25
24
-
*_Add-SPOTheme_— create a new custom theme, or over-write an existing theme to modify its settings
25
-
*_Get-SPOTheme_— retrieve settings for an existing theme
26
-
*_Remove-SPOTheme_— remove a theme from the theme gallery
27
-
*_Set-HideDefaultThemes_— specify whether or not the default "out of box" themes should be available
28
-
*_Get-HideDefaultThemes_— query the current HideDefaultThemes setting
29
-
30
-
Each of these commands is described in more detail below.
26
+
***Add-SPOTheme**— Creates a new custom theme, or overwrites an existing theme to modify its settings.
27
+
***Get-SPOTheme**— Retrieves settings for an existing theme.
28
+
***Remove-SPOTheme**— Removes a theme from the theme gallery.
29
+
***Set-HideDefaultThemes**— Specifies whether the default themes should be available.
30
+
***Get-HideDefaultThemes**— Queries the current HideDefaultThemes setting.
31
31
32
32
## Add-SPOTheme
33
33
34
-
This command creates a new theme or updates an existing theme. The color pallette settings are passed as a dictionary.
34
+
The **Add-SPOTheme** command creates a new theme or updates an existing theme. The color pallette settings are passed as a dictionary.
35
35
36
-
In the example below, a new theme named "Custom Cyan" is created, with color pallette settings that are various shades of cyan. Note that this example uses a ```HashToDictionary``` function to convert a hash table created with the ```@{}``` notation into a dictionary as required by Add-SPOTheme.
36
+
In the following example, a new theme named "Custom Cyan" is created, with color pallette settings that are various shades of cyan. Note that this example uses a ```HashToDictionary``` function to convert a hash table created with the ```@{}``` notation into a dictionary, as required by **Add-SPOTheme**.
If you would like to update an existing theme (to modify some of its color settings, for example), use the same syntax as shown above but add the *-Overwrite* flag to the Add-SPOTheme command:
80
+
If you want to update an existing theme (to modify some of its color settings, for example), use the same syntax as shown previously but add the *-Overwrite* flag to the **Add-SPOTheme** command.
Adding a theme does not apply the theme to any sites. It adds the theme to your tenant store, and then the theme will be available in the list of themes under the "Change the look" option for modern pages.
85
+
Adding a theme does not apply the theme to any sites. It adds the theme to your tenant store, and then the theme will be available in the list of themes under the **Change the look** option for modern pages.
85
86
86
87
## Get-SPOTheme
87
88
88
-
This command returns the settings for an existing theme. For example, here's how to use the Get-SPOTheme command to return the settings for the "Custom Cyan" theme created in the previous example:
89
+
The **Get-SPOTheme**command returns the settings for an existing theme. For example, here's how to use the **Get-SPOTheme** command to return the settings for the "Custom Cyan" theme created in the previous example.
Note that the example above uses PowerShell's_ConvertTo-Json_ filter to display the theme in JSON format.
127
+
Note that this example uses the PowerShell _ConvertTo-Json_ filter to display the theme in JSON format.
127
128
128
-
To see all of the themes currently available in the tenant store, use Get-SPOTheme with no arguments:
129
+
To see all the themes currently available in the tenant store, use **Get-SPOTheme** with no arguments.
129
130
130
131
```powershell
131
132
c:\> Get-SPOTheme
@@ -141,40 +142,43 @@ Custom Cyan
141
142
```
142
143
## Remove-SPOTheme
143
144
144
-
This command removes a theme from your tenant store. For example, this command removes the "Custom Cyan" theme that was used in the above examples:
145
+
The **Remove-SPOTheme** command removes a theme from your tenant store. For example, this command removes the "Custom Cyan" theme that was used in the previous examples.
146
+
145
147
```powershell
146
148
c:\> Remove-SPOTheme -Name "Custom Cyan"
147
149
```
148
150
## Set-HideDefaultThemes
149
151
150
-
_NOTE: this command will be renamed to ```Set-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands. This document will be updated to reflect the change at that time._
152
+
_NOTE: this command will be renamed to ```Set-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands._
153
+
154
+
The **Set-HideDefaultThemes** command is used to specify whether the default themes that come with SharePoint should be included in the theme picker list. For example, you might want to create custom themes for your sites and then remove the default themes, to ensure that all pages will use your custom themes.
151
155
152
-
This command is used to specify whether or not the default themes that come with SharePoint should be included in the theme picker list. For example, you may want to create custom themes for your sites and then remove the default themes, to assure that all pages will use your custom themes.
156
+
Specify the setting as either _$true_ to hide the default themes, or _$false_ (the default setting) to allow use of the default themes. For example, this command hides the default themes.
153
157
154
-
Specify the setting as either _$trule_ to hide the default themes, or _$false_ (the default setting) to allow use of the default themes. For example, this command hides the default themes:
155
158
```powershell
156
159
Set-HideDefaultThemes $true
157
160
```
158
-
After creating the "Custom Cyan" theme as shown above under Add-SPOTheme, hiding the default themes will leave only the one custom theme in the themes list under the gear icon / Change the look:
161
+
After creating the "Custom Cyan" theme, hiding the default themes will leave only the one custom theme in the themes list under **Change the look**.

161
164
162
-
To restore the default themes to the theme picker list, use this command:
165
+
To restore the default themes to the theme picker list, use the following command.
163
166
```powershell
164
167
Set-HideDefaultThemes $false
165
168
```
166
169
167
170
## Get-HideDefaultThemes
168
171
169
-
_NOTE: this command will be renamed to ```Get-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands. This document will be updated to reflect the change at that time._
172
+
_NOTE: this command will be renamed to ```Get-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands._
173
+
174
+
The **Get-HideDefaultThemes** command retrieves the currrent **Set-HideDefaultThemes** setting. You might want to use this command in a PowerShell script to read the setting and then take different actions based on whether the default themes are hidden. This command does not have any parameters.
170
175
171
-
This command retrieves the currrent Set-HideDefaultThemes setting. You may want to use this command in a PowerShell script to read the setting and then take different actions based on whether the default themes are hidden or not. There are no parameters for this command:
172
176
```powershell
173
177
c:\> Get-HideDefaultThemes
174
178
False
175
179
```
176
180
177
-
## Additional resources
181
+
## See also
178
182
179
183
*[SharePoint site theming overview](sharepoint-site-theming-overview.md)
180
184
*[SharePoint site theming: JSON schema](sharepoint-site-theming-json-schema.md)
0 commit comments