Question

I have a project that has a custom master page created from seattle.master. The only change in the .master file is the addition of a <SharePoint:ScriptLink> tag pointing to a copy of d3.min.js on our server. Nothing else in the master page is customized.

The project creates a composed look and it works as expected. The issue is when I select "Change the look" and choose my custom master page from the Site Layout dropdown, the master page will not read my .spcolor file included in the project.

I have a Module named MasterPage with the following code:

<?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="MasterPage" Url="_catalogs/masterpage">
          <File Path="MasterPage\dynetics.master" Url="dynetics.master" Type="GhostableInLibrary" ReplaceContent="TRUE">
              <Property Name="ContentType" Value="Master Page" Type="string"></Property>
              <Property Name="UIVersion" Value="15" Type="int"></Property>
              <Property Name="ContentTypeId" Value="0x010105"></Property>
              <Property Name="Title" Value="Dynetics"></Property>
          </File>
          <File Path="MasterPage\dynetics.preview" Url="dynetics.preview" Type="GhostableInLibrary" ReplaceContent="TRUE">
              <Property Name="ContentType" Value="Master Page Preview" Type="string"></Property>
              <Property Name="UIVersion" Value="15"></Property>
              <Property Name="Title" Value="Dynetics"></Property>
          </File>
      </Module>
  </Elements>

And a Module named Theme:

<?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <Module Name="Theme" Url="_catalogs/theme/15">
            <File Path="Theme\dynetics.spcolor" Url="dynetics.spcolor" Type="GhostableInLibrary" ReplaceContent="TRUE" />
            <File Path="Theme\dynetics.spfont" Url="dynetics.spfont" Type="GhostableInLibrary" ReplaceContent="TRUE" />
        </Module>
    </Elements>

And the Event Receiver:

    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        using (SPSite site = properties.Feature.Parent as SPSite)
        {
            using (SPWeb web = site.RootWeb)
            {
                SPList list = web.Lists.TryGetList("Composed Looks");
                var relativePath = web.ServerRelativeUrl;
                var spcolor = relativePath + "_catalogs/theme/15/dynetics.spcolor";
                var spfont = relativePath + "_catalogs/theme/15/dynetics.spfont";
                var spimage = relativePath + "_layouts/15/images/geometry.jpg";

                if (web != null || web.Exists)
                {
                    foreach (SPListItem composedLook in list.Items)
                    {
                        if (composedLook.Title == "Dynetics")
                        {
                            composedLook.Delete();
                            composedLook.Update();
                        }
                    }

                    SPListItem dynetics = list.AddItem();
                    dynetics["Name"] = "Dynetics";
                    dynetics["Title"] = "Dynetics";
                    dynetics["Master Page URL"] = web.MasterUrl;
                    dynetics["Theme URL"] = spcolor;
                    dynetics["Image URL"] = spimage;
                    dynetics["Font Scheme URL"] = spfont;
                    dynetics["Display Order"] = 1;
                    dynetics.Update();

                    web.Update();
                }
            }
        }
    }

What do I need to do to get the new theme to pick up the included .spcolor file?

Was it helpful?

Solution

After weeks of trying to debug this issue, a support ticket submitted with Microsoft, and no end in sight, I built a new server and deployed the solution to it.

It worked.

There is no resolution as to why the .spfont file will not work with a custom master page in our current environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top