Udostępnij za pośrednictwem


6. Upgrading SharePoint Site Definitions from v2 to v3: CREATING THE MASTER PAGES

There are many ways to create and add a custom Master Page to a SharePoint site, site collection, web application or web farm, but in this case where we are setting up Site Definitions for running an upgrade our goal is to create a Master Page which is attached to a set of custom Site Definitions so that when users create a new "Site", the custom Master Page will be used instead of the default Master Page. 

Therefore your custom Master Page should live in the same location on the web front ends (WFEs) as the default Master Page - in the Global folder located at: 

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL

You can start from scratch to create your custom Master Page by starting with a minimal master.page - instructions for which you can find at:

https://msdn2.microsoft.com/en-us/library/aa660698.aspx

Or you can copy the default.master in the GLOBAL folder, paste it back into the GLOBAL folder and rename the copy <MyPortal>custom.master

You can modify your <MyPortal>custom.master with the changes that you need as long as you don't delete any of the required elements - everything included in the minimal master page above is required, but note that as in the minimal master page you can hide elements by putting them into a panel with visible="false" so that they don't show up - as shown in this chunk taken from the minimal master page:

<asp:Panel visible="false" runat="server">
<%-- These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%>
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" />
</asp:Panel>

One strategy is to paste the panel above at the bottom of the master page right above the </form> tag and then using Find, delete out any duplicate Place Holders.

To test your master page, without first creating a custom Site Definition, upload it into the Master Page gallery and then apply it to an existing site.

For info on how to add this new master page into your custom Site Definition(s), see blog entry 9 "Creating The Site Definition".