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).
0 commit comments