Quantcast
Channel: Microsoft Online: SharePoint Online forum
Viewing all articles
Browse latest Browse all 10096

SharePoint Online & O365 Suite bar - Overwritten by site theme

$
0
0

Hello,

I'm struggling with SharePoint Online to apply a look from a CSOM call. The look I'm applying is the "Office" look, unfortunately this is the only look for which the problem appears.

When running the manual procedure, the Office suite bar will be displayed with a black background-color, which is not what is defined in the Office look by default. When using the automated procedure, the color palette is well applied, the Suite bar displays with a Sharepoint-ish blue. Of course, users want me to automate the same result as obtained with the UI procedure.

What is this little je-ne-sais-quoi the UI manual procedure does that impacts the portal.office.com/data.theme call, despite what is defined in the Office composed look's color palette ?

Is there a setting accessible through the API forcing the portal.office.com/data.theme call parameters to custom values ?

Manual procedure:

Site settings > Change the look > Choose Office (or current if left to default) > Preview > Apply

The rendered HTML page will then have a "shellThemeLink" link element that is defined like this :

<link rel="stylesheet" href="https://portal.office.com/data.theme?action=tc&amp;tc=0072C6|000000|FFFFFF|FFFFFF&amp;tt=G2&amp;tv=b2ceace1-5412-4b7d-8a42-adca8b943ff0&amp;l=ja-JP" type="text/css" id="shellThemeLink">

Automated procedure:

I use the OfficeDev.PnP library but ultimately the call causing the look change is the web.applytheme method as follows:

// https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.client.web.applytheme.aspx

using (ClientContext ctx = SharePointContextHelper.GetSiteAdminContext(siteUrl))
{  
    string colorUrl = "/sites/xyz/_catalogs/theme/15/Palette001.spcolor"; // Office look color palette
    ctx.Web.ApplyTheme(colorUrl, null, null, shareGenerated: true);
    ctx.ExecuteQuery();
}

The "shellThemeLink" link element will be different:

<link rel="stylesheet" href="https://portal.office.com/data.theme?action=tcspo&amp;v=1&amp;tc=%230072c6%7C%23444444%7C%230072c6%7C%23ffffff%7C%2392c0e0%7Crgba(239%2C%20239%2C%20239%2C%200.78)%7C%23666666%7C%23333333%7C%23ffffff%7Crgba(205%2C%20230%2C%20247%2C%200.50)%7C%23dedede&amp;l=ja-JP" type="text/css" id="shellThemeLink">


Viewing all articles
Browse latest Browse all 10096

Trending Articles