Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Modern page Custom Theme by code

$
0
0

Hi

How do I set a custom color theme to a modern page by code? Preferable c#.

I have 2 different site collections and will provision pages under both of them but with different color themes.

I'm able to do it under the root (ctx = http://tenant.sharepoint.com) 

using: 

ctx.Web.ApplyTheme("/_catalogs/theme/15/Palette023.spcolor", null, null, true);

But when I try to do it under a sitecollection (ctx = http://tenant.sharepoint.com/sites/external) I get "File not found".

When I enter the path "http://tenant.sharepoint.com/sites/external/_catalogs/theme/15/Palette023.spcolor" in the browser I find the file so the file is there.

What am I doing wrong? Any other ideas on how to achive this(by code)?

Is it possible to set theme for each site created under the site collection individually? 


Viewing all articles
Browse latest Browse all 7589

Trending Articles