Вопрос

У меня есть проект, который имеет пользовательскую главную страницу, созданную из Seattle.master.Единственное изменение файла .master - это добавление тегов RenacodicetacodCode, указывая на копию D3.min.js на нашем сервере.Ничто другое на главной странице не настроено.

Проект создает созданный вид, и он работает как ожидалось.Проблема заключается в том, когда я выбираю «Изменить внешний вид» и выберите мою собственную главную страницу из раскрывающегося списка макета сайта, главная страница не будет читать мой файл .spcolor, включенный в проект.

У меня есть модуль с именем MasterPage со следующим кодом:

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

и модуль по имени Тема:

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

и приемник событий:

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

Что мне нужно сделать, чтобы получить новую тему, чтобы забрать включенный файл .spcolor?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top