3

我必须为必须包含预定义 Web 部件页面的客户端创建站点定义。我可以创建 Web 部件页面,但在创建时将它们附加到网站时不知所措。

我知道通过 SharePoint 创建的 Web 部件页面存储在文档库中。我是否需要预先填充“Web 部件页面”文档库并向这些文件添加所需的导航?如果是这样,我该如何添加所需的 aspx 文件?

最后,在 onet 中配置自定义 Web 部件页面时,我应该注意哪些注意事项?

4

2 回答 2

4

您可以在 ONET.XML 中设置页面。

首先将 Web 部件页面模板添加到您的站点定义。

然后在您的 ONET.XML 中提供页面实例(添加了 web 部分)。

Ted Pattison 的《Windows SharePoint Services 3.0 内幕》一书中全面描述了这些内容

默认.aspx

<%@ Assembly Name="Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    
          Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage" %>

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
    <table cellspacing="0" border="0" width="100%">
      <tr>
       <td class="ms-pagebreadcrumb">
            <asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/>
       </td>
      </tr>
      <tr>
        <td>
         <table width="100%" cellpadding=0 cellspacing=0 style="padding: 5px 10px 10px 10px;">
          <tr>
           <td valign="top" width="70%">
               <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Left" Title="loc:Left" />
               &nbsp;
           </td>
           <td>&nbsp;</td>
           <td valign="top" width="30%">
               <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Right" Title="loc:Right" />
               &nbsp;
           </td>
           <td>&nbsp;</td>
          </tr>
         </table>
        </td>
      </tr>
    </table>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
    <SharePoint:ProjectProperty ID="ProjectProperty1" Property="Title" runat="server"/>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
         <label class="ms-hidden"><SharePoint:ProjectProperty ID="ProjectProperty2" Property="Title" runat="server"/></label>
</asp:Content>

ONET.xml 片段

<Module Name="Default" Url="" >
  <File Url="default.aspx" Type="Ghostable">
    <!-- Add a Web Part to left zone -->
    <AllUsersWebPart WebPartZoneID="Left" WebPartOrder="0">
      <![CDATA[         
       <WebPart 
         xmlns="http://schemas.microsoft.com/WebPart/v2"
         xmlns:cewp="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
         <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
         <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
         <Title>Working with Site Definitions</Title>
         <FrameType>TitleBarOnly</FrameType>
         <cewp:Content>
           This Web Part was added through declarative logic in ONET.XML
         </cewp:Content>
       </WebPart>
       ]]>
    </AllUsersWebPart>
  </File>
</Module>
于 2008-10-25T11:05:14.580 回答
1

您可以遵循这种使用特征装订的方法。我使用它在创建 Web 部件时自动将它们添加到我的网站:

http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterprise.aspx

于 2008-10-24T20:52:55.830 回答