I am trying to get all of the available themes for a site collection. When I call GetManagedThemes() I get 0 results. I have tried several site collections and they all return 0 themes.
internal static List<ThmxTheme> GetAvailableThemes(string siteUrl)
{
List<ThmxTheme> themes = new List<ThmxTheme>();
using (SPSite projectSite = new SPSite(siteUrl))
{
using (SPWeb web = projectSite.OpenWeb())
{
ReadOnlyCollection<ThmxTheme> thmxThemes = ThmxTheme.GetManagedThemes(projectSite);
foreach (ThmxTheme theme in thmxThemes)
{
themes.Add(theme);
}
}
}
return themes;
}
The code above is shown in many examples on the net.
The site collections have the OOB themes available. (I can change the theme using the "Change the Look" option in settings.)