Forum Discussion
AsadRefai
Nov 28, 2018Copper Contributor
How to Apply default modern themes like Purple Red Orange using csom
I am using OfficeDevPnP solution to provision my SharePoint Team Site Collections. I am creating Modern Home Pages, Modern Libraries (Enabling List level Experience, not from Tenant level) etc.
I have noticed that there is a big list of default themes like Blue, Purple, Red etc. Which can be changed easily using "Change the look" menu item from the COG.
In the classic world if I would have want to set a Theme while provisioning a Team Site Collection, I would have used below code
web.ApplyTheme(paletteServerRelativeUrl, fontServerRelativeUrl, backgroundServerRelativeUrl, shareGenerated: true);
web.Context.ExecuteQueryRetry();
Now while provisioning a team site collection if I want to set Modern default themes as "Purple", then what should my code look like? Or is it possible? I am sorry for my ignorance if question looks silly to anyone. :)