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-csom.md
+20-17Lines changed: 20 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,25 @@
1
1
# SharePoint site theming: CSOM development
2
2
3
-
The SharePoint Client Side Object Model (CSOM) provides .NET developers with access to the SharePoint object model from code that is running locally or on a different server than SharePoint. This topic covers the site theming functionality available in CSOM.
3
+
The SharePoint client-side object model (CSOM) provides access to the SharePoint object model from code that is running locally or on a different server than SharePoint.
4
4
5
5
## Prerequisites
6
-
This topic assumes you are familiar with the topics [Using the Client Object Model](https://msdn.microsoft.com/en-us/library/ff798388.aspx) and [Common Programming Tasks in the Managed Client Object Model](https://msdn.microsoft.com/en-us/library/ee537013.aspx), which cover how to work with the SharePoint CSOM.
6
+
Before you get started, make sure that you're familiar with the following:
7
+
-[Using the Client Object Model](https://msdn.microsoft.com/en-us/library/ff798388.aspx)
8
+
-[Common Programming Tasks in the Managed Client Object Model](https://msdn.microsoft.com/en-us/library/ee537013.aspx)
7
9
8
10
Install the following components for CSOM development:
9
11
10
12
*[SharePoint Server 2016 Client Component SDK](https://www.microsoft.com/en-us/download/details.aspx?id=51679)
11
13
*[Microsoft.SharePointOnline.CSOM](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/) NuGet package (version 16.1.6906.1200 or later)
12
14
13
-
## Sample code
15
+
## CSOM code example
14
16
15
-
The following sample shows how to create a __Microsoft.Online.SharePoint.TenantAdministration.Tenant__ object and call the __GetAllTenantThemes__ method to return a list of themes. Notes on this sample:
17
+
The following example shows how to create a __Microsoft.Online.SharePoint.TenantAdministration.Tenant__ object and call the __GetAllTenantThemes__ method to return a list of themes.
16
18
17
-
* The URL used for creating the context object includes the _-admin_ suffix, because TenantAdministration methods work with the admin site.
18
-
* Create a __Tenant__ instance with the [Tenant constructor](https://msdn.microsoft.com/en-us/library/dn174852.aspx), and then call the methods on that instance.
19
-
* The same approach can be used for calling other theme management methods.
19
+
>**Note:**
20
+
>* The URL used to create the context object includes the _-admin_ suffix, because **TenantAdministration** methods work with the admin site.
21
+
>* Create a __Tenant__ instance with the [Tenant constructor](https://msdn.microsoft.com/en-us/library/dn174852.aspx), and then call the methods on that instance.
22
+
>* You can use the same approach to call other theme management methods.
20
23
21
24
```C#
22
25
usingSystem.Security;
@@ -33,7 +36,7 @@ Tenant tenant = new Tenant(ctx);
For methods that take a theme argument, the following code defines an __SPOTheme__ class that you can use to create custom themes.
39
42
@@ -69,11 +72,11 @@ public class SPOTheme
69
72
70
73
## Applying a theme
71
74
72
-
The methods covered below are used to manage the available themes in your tenant. To _apply_ a theme to a particular SharePoint web site, use the [SPWeb.ApplyTheme](https://msdn.microsoft.com/en-us/library/office/jj251358.aspx) method of the [Microsoft.SharePoint.Client.Web](https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.web.aspx) class.
75
+
The methods described in this section are used to manage the available themes in your tenant. To _apply_ a theme to a particular SharePoint website, use the [SPWeb.ApplyTheme](https://msdn.microsoft.com/en-us/library/office/jj251358.aspx) method of the [Microsoft.SharePoint.Client.Web](https://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.web.aspx) class.
73
76
74
77
## Methods/properties of the Microsoft.Online.SharePoint.TenantAdministration.Tenant class
75
78
76
-
These methods can be used to customize a SharePoint tenant administration site's set of available themes. You can add a new custom theme, update an existing theme, or delete a theme, and you can retrieve a specific theme or all themes. You can also hide or restore the default themes that come with SharePoint.
79
+
Use the following methods to customize the set of available themes for a SharePoint tenant administration site. You can add a new custom theme, update an existing theme, or delete a theme, and you can retrieve a specific theme or all themes. You can also hide or restore the default themes that come with SharePoint.
Retrieve all of the themes currently available in the tenant, including any custom themes that have been added. Default themes are only included if the __HideDefaultThemes__ property is __false__ (the default value).
96
+
Retrieve all the themes that are currently available in the tenant, including any custom themes that have been added. Default themes are only included if the __HideDefaultThemes__ property is __false__ (the default value).
This property indicates whether the default themes ("out of the box" themes) are hidden in the theme picker user interface for modern pages. You might want to set this property to __true__ after defining custom themes, to allow only specific themes to be used.
110
+
This property indicates whether the default themes are hidden in the theme picker UI for modern pages. You might want to set this property to __true__ after you define custom themes, to allow only specific themes to be used.
Retrieve all of the themes currently available in the tenant, including any custom themes that have been added. Default themes are only included if the __HideDefaultThemes__ property is __false__ (the default value).
134
+
Retrieve all the themes that are currently available in the tenant, including any custom themes that have been added. Default themes are only included if the __HideDefaultThemes__ property is __false__ (the default value).
Copy file name to clipboardExpand all lines: docs/declarative-customization/site-theming/sharepoint-site-theming-json-schema.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
The new [SharePoint site theming](sharepoint-site-theming-overview.md) features use a JSON schema to store color settings and other information about each theme. Theme settings are stored in a JSON object that contains the following keys:
4
4
5
-
*__name__— The name of the theme, which appears in the theme picker UI and is also used by administrators and developers to refer to the theme in PowerShell commands or calls to the SharePoint REST API.
5
+
*__name__— The name of the theme, which appears in the theme picker UI and is also used by administrators and developers to refer to the theme in PowerShell cmdlets or calls to the SharePoint REST API.
6
6
*__isInverted__— This value should be false for light themes and true for dark themes; it controls whether SharePoint will use dark or light theme colors to render text on colored backgrounds.
7
7
*__backgroundImageUril__— The URI of an optional background image for the theme (value can be blank if no background image).
8
8
*__theme__— The RGB color settings for the theme, stored as a nested JSON object with the following keys:
@@ -376,6 +376,6 @@ The following code shows how to define a dictionary in PowerShell for the Dark B
376
376
## See also
377
377
378
378
*[SharePoint site theming overview](sharepoint-site-theming-overview.md)
379
-
*[SharePoint site theming: PowerShell commands](sharepoint-site-theming-powershell.md)
379
+
*[SharePoint site theming: PowerShell cmdlets](sharepoint-site-theming-powershell.md)
380
380
*[SharePoint site theming: CSOM](sharepoint-site-theming-csom.md)
381
381
*[SharePoint site theming: REST API](sharepoint-site-theming-rest-api.md)
Copy file name to clipboardExpand all lines: docs/declarative-customization/site-theming/sharepoint-site-theming-overview.md
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ SharePoint site owners have new options for applying custom styles and colors to
6
6
* A simplified set of default themes, with six light themes and two dark themes presently available.
7
7
* Control over which themes are available for use on pages within your sites. For example, you can define custom themes based on your organization's branding or identity, and make those the only available themes within your sites.
8
8
9
-
<!-- Global: We should refer to PowerShell "cmdlets" instead of "commands", to be consistent with the admin docs on TechNet. -->
10
-
11
-
These capabilities are available to administrators via [PowerShell commands](sharepoint-site-theming-powershell.md), and to developers via the SharePoint [Client Side Object Model (CSOM)](sharepoint-site-theming-csom.md) or the SharePoint [REST API](sharepoint-site-theming-rest-api.md).
9
+
These capabilities are available to administrators via [PowerShell cmdlets](sharepoint-site-theming-powershell.md), and to developers via the SharePoint [Client Side Object Model (CSOM)](sharepoint-site-theming-csom.md) or the SharePoint [REST API](sharepoint-site-theming-rest-api.md).
12
10
13
11
For general information about working with themes to customize the look of your sites, see [Change the look of your SharePoint site](https://support.office.com/en-us/article/Change-the-look-of-your-SharePoint-site-06bbadc3-6b04-4a60-9d14-894f6a170818).
14
12
@@ -54,6 +52,6 @@ For the simplest experience, we recommend that you use modern themes with modern
54
52
## See also
55
53
56
54
*[SharePoint site theming: JSON schema](sharepoint-site-theming-json-schema.md)
57
-
*[SharePoint site theming: PowerShell commands](sharepoint-site-theming-powershell.md)
55
+
*[SharePoint site theming: PowerShell cmdlets](sharepoint-site-theming-powershell.md)
58
56
*[SharePoint site theming: CSOM](sharepoint-site-theming-csom.md)
59
57
*[SharePoint site theming: REST API](sharepoint-site-theming-rest-api.md)
Copy file name to clipboardExpand all lines: docs/declarative-customization/site-theming/sharepoint-site-theming-powershell.md
+17-21Lines changed: 17 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,25 @@
1
-
# SharePoint site theming: PowerShell commands
1
+
# SharePoint site theming: PowerShell cmdlets
2
2
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.
3
+
SharePoint tenant administrators can use PowerShell cmdlets 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.
6
4
7
5
For information about how themes are defined and stored, see [JSON schema reference](sharepoint-site-theming-json-schema.md).
8
6
9
7
## Getting started
10
8
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:
9
+
To run the PowerShell cmdlets for theme management, you'll need to do the following:
12
10
13
11
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.
12
+
2.Follow the instructions at [Connect to SharePoint Online PowerShell](https://technet.microsoft.com/en-us/library/fp161372.aspx) to connect to your SharePoint tenant.
15
13
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.
14
+
To verify your setup, try using the **Get-HideDefaultThemes**cmdlet to read the HideDefaultThemes setting. If the cmdlet runs and returns False with no errors, as shown in the following example, you're ready to proceed.
17
15
18
16
```powershell
19
17
c:\> Get-HideDefaultThemes
20
18
False
21
19
```
22
-
## Site theme commands
20
+
## Site theme cmdlets
23
21
24
-
The following commands are available for managing site themes from PowerShell:
22
+
The following cmdlets are available for managing site themes from PowerShell:
25
23
26
24
***Add-SPOTheme**— Creates a new custom theme, or overwrites an existing theme to modify its settings.
27
25
***Get-SPOTheme**— Retrieves settings for an existing theme.
@@ -31,7 +29,7 @@ The following commands are available for managing site themes from PowerShell:
31
29
32
30
## Add-SPOTheme
33
31
34
-
The **Add-SPOTheme**command creates a new theme or updates an existing theme. The color pallette settings are passed as a dictionary.
32
+
The **Add-SPOTheme**cmdlet creates a new theme or updates an existing theme. The color pallette settings are passed as a dictionary.
35
33
36
34
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 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.
78
+
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**cmdlet.
@@ -86,7 +84,7 @@ Adding a theme does not apply the theme to any sites. It adds the theme to your
86
84
87
85
## Get-SPOTheme
88
86
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.
87
+
The **Get-SPOTheme**cmdlet returns the settings for an existing theme. For example, here's how to use the **Get-SPOTheme**cmdlet to return the settings for the "Custom Cyan" theme created in the previous example.
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.
143
+
The **Remove-SPOTheme**cmdlet removes a theme from your tenant store. For example, this cmdlet removes the "Custom Cyan" theme that was used in the previous examples.
146
144
147
145
```powershell
148
146
c:\> Remove-SPOTheme -Name "Custom Cyan"
149
147
```
150
148
## Set-HideDefaultThemes
151
149
152
-
>[!NOTE]
153
-
>This command will be renamed to ```Set-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands.
150
+
_NOTE: this cmdlet will be renamed to ```Set-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell cmdlet._
154
151
155
-
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.
152
+
The **Set-HideDefaultThemes**cmdlet 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.
156
153
157
-
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.
154
+
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 cmdlet hides the default themes.
158
155
159
156
```powershell
160
157
Set-HideDefaultThemes $true
@@ -163,17 +160,16 @@ After creating the "Custom Cyan" theme, hiding the default themes will leave onl
163
160
164
161

165
162
166
-
To restore the default themes to the theme picker list, use the following command.
163
+
To restore the default themes to the theme picker list, use the following cmdlet.
167
164
```powershell
168
165
Set-HideDefaultThemes $false
169
166
```
170
167
171
168
## Get-HideDefaultThemes
172
169
173
-
>[!NOTE]
174
-
>This command will be renamed to ```Get-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell commands.
170
+
_NOTE: this cmdlet will be renamed to ```Get-SPOHideDefaultThemes``` in a future release, for consistency with other SharePoint PowerShell cmdlets._
175
171
176
-
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.
172
+
The **Get-HideDefaultThemes**cmdlet retrieves the currrent **Set-HideDefaultThemes** setting. You might want to use this cmdlet in a PowerShell script to read the setting and then take different actions based on whether the default themes are hidden. This cmdlet does not have any parameters.
0 commit comments