Domanda

Ho un progetto che ha una pagina master personalizzata creata da Seattle.master.L'unico cambiamento nel file .master è l'aggiunta di un tag <SharePoint:ScriptLink> che punta a una copia di d3.min.js sul nostro server.Nient'altro nella Pagina principale è personalizzato.

Il progetto crea un aspetto composto e funziona come previsto.Il problema è quando selezionando "Cambia il look" e scegli la mia pagina master personalizzata dal dislungamento del layout del sito, la pagina master non leggerà il mio file .spcolor incluso nel progetto.

Ho un modulo denominato Masterpage con il seguente codice:

<?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>
.

e un modulo denominato tema:

<?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>
.

e il ricevitore dell'evento:

    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();
                }
            }
        }
    }
.

Cosa devo fare per ottenere il nuovo tema per raccogliere il file .spcolor incluso?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top