Skip to content

Commit cab17c2

Browse files
RongqiZrongqizhou
andauthored
update sharepoint site theming docs (#10606)
* update sharepoint site theming json schema * update * update site theming overview * update site theme csom * update sharepoint theme rest api * update theme json store schema * update * update image * update * update * update doc * update doc * update csom doc * update * update version --------- Co-authored-by: rongqizhou <rongqizhou+odspmdb@microsoft.com>
1 parent 8d081e1 commit cab17c2

6 files changed

Lines changed: 490 additions & 593 deletions

File tree

28.7 KB
Loading

docs/declarative-customization/site-theming/sharepoint-site-theming-csom.md

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: SharePoint site theming - CSOM development
33
description: 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-
ms.date: 06/28/2022
4+
ms.date: 02/25/2026
55
ms.localizationpriority: high
66
---
77

@@ -16,11 +16,11 @@ Before you get started, make sure that you're familiar with the following:
1616
- [Using the Client Object Model](https://msdn.microsoft.com/library/ff798388.aspx)
1717
- [Common Programming Tasks in the Managed Client Object Model](https://msdn.microsoft.com/library/ee537013.aspx)
1818

19-
You also need to reference the [Microsoft.SharePointOnline.CSOM](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/) NuGet package (version 16.1.6906.1200 or later).
19+
You also need to reference the [Microsoft.SharePointOnline.CSOM](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/) NuGet package (version 16.0.27011.12008 or later).
2020

2121
## CSOM code example
2222

23-
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.
23+
The following example shows how to create a __Microsoft.Online.SharePoint.TenantAdministration.Tenant__ object and call the __GetAllGlobalThemes__ method to return a list of themes.
2424

2525
> [!NOTE]
2626
> * The URL used to create the context object includes the _-admin_ suffix because **TenantAdministration** methods work with the admin site.
@@ -41,12 +41,12 @@ var passWord = new SecureString();
4141
foreach (char c in pwd.ToCharArray()) passWord.AppendChar(c);
4242
ctx.Credentials = new SharePointOnlineCredentials("admin@mydomain.com", passWord);
4343
Tenant tenant = new Tenant(ctx);
44-
ClientObjectList<ThemeProperties> themes = tenant.GetAllTenantThemes();
44+
ClientObjectList<ThemeProperties> themes = tenant.GetAllGlobalThemes();
4545
```
4646

4747
## Theme definition example
4848

49-
For methods that take a theme argument, the following code defines an __SPOTheme__ class that you can use to create custom themes.
49+
For methods that take a theme argument, the following code defines an __SPOTheme__ class that you can use to create custom themes. For the new theme format, only the `Name` and `ColorPairs` properties are required. For the legacy theme format, the `Name`, `Palette`, and `IsInverted` properties are required.
5050

5151
```csharp
5252
/// <summary
@@ -67,6 +67,13 @@ public class SPOTheme 
6767
    public IDictionary<String, String> Palette 
6868
    { 
6969
        get; private set
70+
    } 
71+
/// <summary
72+
/// Specifies the color pairs setting of the theme.
73+
    /// </summary
74+
    public IDictionary<string, IList<Dictionary<string, string>>> ColorPairs
75+
    { 
76+
        get; private set
7077
    } 
7178
    /// <summary
7279
    /// Specifies whether the theme is inverted, with a dark background and a light foreground. 
@@ -86,44 +93,31 @@ There's currently no supported CSOM API to programmatically apply a theme to a s
8693

8794
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.
8895

89-
### AddTenantTheme public method
96+
### AddTenantThemeAdvanced public method
9097

91-
Add a theme to the tenant.
98+
Add a theme to the organization.
9299

93-
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
94-
__Parameters:__ string name, string themeJson<br/>
95-
__Return type:__ ClientResult\<bool\>
96-
97-
### DeleteTenantTheme public method
98-
99-
Delete a theme from the tenant.
100+
In multi-geo environments, themes added by an administrator in the primary geography are automatically propagated and available across the organization. This method is not supported for administrators in satellite geographies.
100101

101102
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
102-
__Parameters:__ string name<br/>
103-
__Return type:__ void
104-
105-
### GetAllTenantThemes public method
106-
107-
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).
108-
109-
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
110-
__Parameters:__ none<br/>
111-
__Return type:__ ClientObjectList\<ThemeProperties\>
103+
__Parameters:__ string name, string themeJson, bool shouldParseColorPair<br/>
104+
__Return type:__ ClientResult\<bool\>
112105

113-
### GetTenantTheme public method
106+
### UpdateTenantThemeAdvanced public method
114107

115-
Retrieve a theme by name.
108+
Update the settings for an existing theme.
116109

117110
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
118-
__Parameters:__ string name<br/>
119-
__Return type:__ ThemeProperties
111+
__Parameters:__ string name, string themeJson, bool shouldParseColorPair<br/>
112+
__Return type:__ ClientResult\<bool\>
120113

121-
### HideDefaultThemes public property
114+
### AddTenantTheme public method
122115

123-
This property indicates whether the default themes are available in the theme picker UI. The default setting is __false__ (the default themes are available), but you might want to set this property to __true__ after you define custom themes, to allow only specific themes to be used.
116+
Add a theme to the organization. This method is not supported for administrators in satellite geographies.
124117

125118
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
126-
__Type:__ Boolean
119+
__Parameters:__ string name, string themeJson<br/>
120+
__Return type:__ ClientResult\<bool\>
127121

128122
### UpdateTenantTheme public method
129123

@@ -132,58 +126,56 @@ Update the settings for an existing theme.
132126
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
133127
__Parameters:__ string name, string themeJson<br/>
134128
__Return type:__ ClientResult\<bool\>
129+
### DeleteTenantTheme public method
135130

136-
## Methods of the Microsoft.Online.SharePoint.TenantManagement.Tenant class
131+
Delete a theme from the tenant.
137132

138-
These are alternative APIs to manage your themes at the tenant level.
133+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
134+
__Parameters:__ string name<br/>
135+
__Return type:__ void
139136

140-
### AddTenantTheme public method
137+
### GetAllGlobalThemes public method
141138

142-
Add a theme to the tenant.
139+
Retrieve the complete set of custom themes defined at the tenant level, including themes created through command-based tools and those created in the Brand Center UI.
140+
> [!NOTE]
141+
> To support consistent branding and simplify governance, theme management is transitioning to a centralized model.
142+
> - The **primary geo** will act as the central location for **organization-wide theme creation and management**. Themes created here will be visible and applicable across satellite geos.
143+
> - The satellite **Geo Administrators** will be able to view themes from the primary geo to their own sites by using `GetAllGlobalThemes` method. Themes previously created within satellite geos will remain available for use. However, **creating new themes in satellite geos will no longer be supported** going forward.
143144
144-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
145-
__Parameters:__ string name, string themeJson<br/>
146-
__Return type:__ ClientResult\<bool\>
145+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
146+
__Parameters:__ none<br/>
147+
__Return type:__ ClientObjectList\<ThemeProperties\>
147148

148149
### GetAllTenantThemes public method
149150

150-
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).
151+
Retrieve all the custom themes that are created on current tenant through command-based tools.
151152

152-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
153+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
153154
__Parameters:__ none<br/>
154155
__Return type:__ ClientObjectList\<ThemeProperties\>
155156

156-
### GetHideDefaultThemes public method
157+
### GetGlobalTheme public method
157158

158-
Read the current setting for whether to hide default themes in the theme picker UI.
159+
Retrieve a theme by name, including themes created through command-based tools and those created in the Brand Center UI.
159160

160-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
161-
__Parameters:__ none<br/>
162-
__Return type:__ ClientResult\<bool\>
161+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
162+
__Parameters:__ string name<br/>
163+
__Return type:__ ThemeProperties
163164

164165
### GetTenantTheme public method
165166

166167
Retrieve a theme by name.
167168

168-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
169+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
169170
__Parameters:__ string name<br/>
170171
__Return type:__ ThemeProperties
171172

172-
### SetHideDefaultThemes public method
173-
174-
Specify whether to hide default themes in the theme picker UI.
175-
176-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
177-
__Parameters:__ Boolean<br/>
178-
__Return type:__ void
179-
180-
### UpdateTenantTheme public method
173+
### HideDefaultThemes public property
181174

182-
Update the settings for an existing theme.
175+
This property indicates whether the default themes are available in the theme picker UI. The default setting is __false__ (the default themes are available), but you might want to set this property to __true__ after you define custom themes, to allow only specific themes to be used.
183176

184-
__Namespace:__ Microsoft.Online.SharePoint.TenantManagement.Tenant<br/>
185-
__Parameters:__ string name, string themeJson<br/>
186-
__Return type:__ ClientResult\<bool\>
177+
__Namespace:__ Microsoft.Online.SharePoint.TenantAdministration.Tenant<br/>
178+
__Type:__ Boolean
187179

188180
## See also
189181

0 commit comments

Comments
 (0)