You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not entirely sure if this is an issue with the theme that was uploaded or with SharePoint or with the SDKs handling of the theme, but presumably SharePoint is treating it as valid.
context.Web.GetBrandingManager().GetAvailableThemesAsync() throws KeyNotFoundException when theme JSON is missing name or isInverted properties.
Steps to reproduce
Upload theme without isInverted or name properties
Try to fetch themes from site using await context.Web.GetBrandingManager().GetAvailableThemesAsync();
var body = new
{
backgroundImageUri = "",
palette = paletteValues,
cacheToken = "",
isDefault = true,
isInverted = customThemeJson.GetProperty("isInverted").GetBoolean(),
version = ""
};
var final = new
{
name = customThemeJson.GetProperty("name").GetString(),
themeJson = JsonSerializer.Serialize(body),
};
Other code in this same method uses TryGetProperty as opposed to GetProperty which causes an exception.
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered:
@kgr-kpmg : a change has been pushed, please test using next nightly release (version 1.7.97 or higher). I'm already closing the issue, but feel free to re-open in case the problem is still not solved for you.
Thanks for using PnP Core SDK and providing feedback!
Category
Describe the bug
Not entirely sure if this is an issue with the theme that was uploaded or with SharePoint or with the SDKs handling of the theme, but presumably SharePoint is treating it as valid.
context.Web.GetBrandingManager().GetAvailableThemesAsync()
throws KeyNotFoundException when theme JSON is missingname
orisInverted
properties.Steps to reproduce
isInverted
orname
propertiesawait context.Web.GetBrandingManager().GetAvailableThemesAsync();
Expected behavior
Error is handled and default values provided.
Environment details (development & target environment)
Additional context
PnP.Core.Model.SharePoint.BrandingManager.NormalizeThemeJson(String themeJson)
Other code in this same method uses TryGetProperty as opposed to GetProperty which causes an exception.
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered: