フィーチャを使用して.previewファイルを追加します
-
10-12-2019 - |
質問
あなたは特徴を挿入した素敵なマスターページでこの機能を持っていて、それはうまく機能します。今、私はテーマを探しています、合成可能な外観を作成しました。デザインマネージャーでこの外観を選択するには、プレビューファイルが必要です。私は単にプレビューファイルを手動でアップロードするだけでこれに成功しました(デフォルトの1つのコピーだけ)。
明らかにこれを続ける必要がなくなり、それをMasterPage機能に追加し、要素ファイルにファイルを追加しました。しかし、マスターページとページレイアウトを展開してチェックすると、プレビューファイルはありません。マスターページは、シアトルとオスロマスターページとそのプレビューファイルです。
並んでどこかで私のプレビューファイルが消えます!
これは要素xmlファイルです:
.<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MasterPages" Url="_catalogs/masterpage" Path="" RootWebOnly="TRUE">
<File Path="MasterPages\sharepoint_mysite.master" Url="sharepoint_mysite.master" Type="GhostableInLibrary">
<Property Name="Title" Value="MySite MasterPage" />
<Property Name="MasterPageDescription" Value="This is the MySite master page." />
</File>
<File Path="MasterPages\sharepoint_mysite.preview" Url="MasterPages/sharepoint_mysite.preview">
<Property Name="Title" Value="MySite MasterPage Preview" />
</File>
</Module>
</Elements>
解決
You should have Type="GhostableInLibrary"
attribute for your preview.
I suppose MasterPages in your solution points to a document library. If you want to provision files from a module to a document library, ghostableinlibrary type must be used:
Specifying GhostableInLibrary means the file will be added to a document library in SharePoint together with a list item to accompany the file when it is added to the library