SOLVED

Modern Theme - Applying to a site without making it generally available to Site Owners

%3CLINGO-SUB%20id%3D%22lingo-sub-1164090%22%20slang%3D%22en-US%22%3EModern%20Theme%20-%20Applying%20to%20a%20site%20without%20making%20it%20generally%20available%20to%20Site%20Owners%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1164090%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20requirement%20to%20create%20in%20the%20region%20of%20100%20SharePoint%20sites%2C%20each%20with%20a%20different%20colour%20theme.%20The%20requirements%20around%20the%20theme%20for%20each%20site%20can%20be%20met%20by%20using%20the%20Modern%20Theme%20functionality%2C%20however%20I%20don't%20want%20them%20to%20be%20visible%20as%20a%20theme%20for%20any%20other%20site%20owners%20to%20select.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20apply%20a%20modern%20theme%20to%20a%20site%20without%20it%20first%20being%20made%20widely%20available%20to%20the%20tenant%20and%20all%20other%20site%20owners%3F%20All%20examples%20I%20see%20of%20the%20modern%20theme%20functionality%20is%20that%20you%20first%20make%20it%20available%20to%20the%20tenant%2C%20then%20apply%20it%20to%20the%20site.%20The%20classic%20theming%20with%20a%20.spcolor%20file%20could%20be%20uploaded%20directly%20to%20a%20site%2C%20which%20I%20could%20do%2C%20but%20I'm%20keen%20to%20not%20rely%20on%20classic%20features.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1164380%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Theme%20-%20Applying%20to%20a%20site%20without%20making%20it%20generally%20available%20to%20Site%20Owners%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1164380%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9396%22%20target%3D%22_blank%22%3E%40Ross%20McLean%3C%2FA%3E%26nbsp%3BYes%20you%20can%20do%20this%20via%20the%20REST%20API.%3CBR%20%2F%3E%3CBR%20%2F%3ECheckout%20this%20web%20part%20that%20David%20Warner%20and%20myself%20built.%20It%20allows%20you%20to%20specify%20the%20URL%20of%20the%20site%20and%20the%20theme%20you%20want%20to%20apply%2C%20without%20adding%20it%20to%20the%20Theme%20options.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-fx-webparts%2Ftree%2Fmaster%2Fsamples%2Fjs-theme-manager%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-dev-fx-webparts%2Ftree%2Fmaster%2Fsamples%2Fjs-theme-manager%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1165941%22%20slang%3D%22en-US%22%3ERe%3A%20Modern%20Theme%20-%20Applying%20to%20a%20site%20without%20making%20it%20generally%20available%20to%20Site%20Owners%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1165941%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F39836%22%20target%3D%22_blank%22%3E%40Beau%20Cameron%3C%2FA%3E%26nbsp%3BExcellent%2C%20thanks%20for%20this!%20I'll%20check%20out%20your%20code%20this%20week.%20Sounds%20exactly%20like%20what%20I%20need.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I have a requirement to create in the region of 100 SharePoint sites, each with a different colour theme. The requirements around the theme for each site can be met by using the Modern Theme functionality, however I don't want them to be visible as a theme for any other site owners to select. 

 

Is it possible to apply a modern theme to a site without it first being made widely available to the tenant and all other site owners? All examples I see of the modern theme functionality is that you first make it available to the tenant, then apply it to the site. The classic theming with a .spcolor file could be uploaded directly to a site, which I could do, but I'm keen to not rely on classic features.

2 Replies
best response confirmed by Ross McLean (Occasional Contributor)
Solution

@Ross McLean Yes you can do this via the REST API.

Checkout this web part that David Warner and myself built. It allows you to specify the URL of the site and the theme you want to apply, without adding it to the Theme options.

https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/js-theme-manager

@Beau Cameron Excellent, thanks for this! I'll check out your code this week. Sounds exactly like what I need.