Создаем страницу и добавляем на нее веб-часть используя feature

??????? ?? ?????????? ?????? ????, ??? ????????? ???????, ?? ??????? ????????? ???????? ? ?? ??????, ? ??? ? ???-??????, ??????????? ? WebPartZone ?????????????.

??????? ????

1. ???????? ? ????? C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES ????? CreatePageExample.
2. ? ????? CreatePageExample ???????? feature.xml ?????????? ??????????:

<?xml version="1.0" encoding="utf-8" ?>

<Feature xmlns="https://schemas.microsoft.com/sharepoint/"

  Id="5FCBCCDC-3532-4505-9CBA-FF904FDADFFF"

  Title="Create Page Example"

  Description="Create page with web parts for example"

  Version="1.0.0.0"

  Scope="Web"

  Hidden="FALSE" >

  <ElementManifests>

      <ElementManifest Location="Elements.xml"/>

  </ElementManifests>

</Feature>

 

  1. ???????? element.xml

<?xml version="1.0" encoding="utf-8" ?>

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">

      <Module Name="Pages" Url="$Resources:cmscore,List_Pages_UrlName;" Path="Pages">

            <File Url="default.aspx" Type="GhostableInLibrary">

                  <Property Name="Title" Value="Test Page" />

                  <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/DefaultLayout.aspx" />

                  <AllUsersWebPart WebPartZoneID="TopZone" WebPartOrder="1">

                        <![CDATA[]]>

                  </AllUsersWebPart>

            </File>

      </Module>

</Elements>

???????? ???????? ????????? ? ?????? Module:

Name – ???????? ?????? (????? ???? ????????????)

 

Path – ???? ? ?????, ??? ????? ?????? ????????. ? ??? ???????? ????? ?????? ? CreatePageExample/Pages, ??????? ?? ????? ?????? Pages.

 

Url – ???? ????? ??????????? ???????? ??? ????????? ????. ? ??? ??? ????? ???????????? ? ?????? Pages

 

??? ?? ??? ????? (File) ????? ?????????? ??? ???????? (Property). ?????? ????????? ??????? ????? ?????????? ? Content Type ???? ???????? (?? ????????? ??? Page) . ????? ?????????????? Content Type ??? ????????, ?????????

<Property Name="ContentType" Value=”” />

? ???????? PublishingPageLayout ?? ?????? ???????, ????? PageLayout ????? ???????????? ???? ????????. ?? ????? layout, ??????? ???????????? ??? ??????? ???????? ???????.

????????????? ????????

? ????? CreatePageExample ???????? ????? Pages ? ??????? ? ??? ???????? default.aspx ?????????? ??????????:

 

<%@ Register TagPrefix="WpNs1" Namespace="TnkBp.SharePoint.Portal.WebParts" Assembly="TnkBp.SharePoint.Portal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5bb9526235c6eae" %>

<%@ Register TagPrefix="WpNs0" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>

<%@ Reference VirtualPath="~TemplatePageUrl" %>

<%@ Reference VirtualPath="~masterurl/custom.master" %>

????????? ???-?????

1. ?? ??????? ??????? ????? ???????? ? ?????? ?????????????? SiteActions ->Edit Page.

2. ??????? ? ????? ???? ???-??????, ????????, ??? ????? ??? ?????? (Search Box)

3. ? ?????????? ???? edit ???-????? ???????? Export

4. ??????? ???????????????? ????, ????????? ??? ?????????? ? ??????? ? element.xml. ?????? ???? ????? ????????? ????????? ???????:

 

<?xml version="1.0" encoding="utf-8" ?>

<Elements xmlns="https://schemas.microsoft.com/sharepoint/">

      <Module Name="Pages" Url="$Resources:cmscore,List_Pages_UrlName;" Path="Pages">

            <File Url="default.aspx" Type="GhostableInLibrary">

                  <Property Name="Title" Value="Test Page" />

                  <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/DefaultLayout.aspx" />

                  <AllUsersWebPart WebPartZoneID="TopZone" WebPartOrder="1">

                        <![CDATA[<WebPart xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema" xmlns="https://schemas.microsoft.com/WebPart/v2">

  <Title>Search Box</Title>

  <FrameType>None</FrameType>

  <Description>Used to search document and items.</Description>

  <IsIncluded>true</IsIncluded>

  <ZoneID>Left</ZoneID>

  <PartOrder>0</PartOrder>

  <FrameState>Normal</FrameState>

  <Height />

  <Width>335px</Width>

  <AllowRemove>true</AllowRemove>

  <AllowZoneChange>true</AllowZoneChange>

  <AllowMinimize>true</AllowMinimize>

  <AllowConnect>true</AllowConnect>

  <AllowEdit>true</AllowEdit>

  <AllowHide>true</AllowHide>

  <IsVisible>true</IsVisible>

  <DetailLink />

  <HelpLink />

  <HelpMode>Modeless</HelpMode>

  <Dir>Default</Dir>

  <PartImageSmall />

  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>

  <PartImageLarge />

  <IsIncludedFilter />

  <Assembly>Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

  <TypeName>Microsoft.SharePoint.Portal.WebControls.SearchBoxEx</TypeName>

  <GoImageUrl xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/gosearch.gif</GoImageUrl>

  <GoImageUrlRTL xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/goRTL.gif</GoImageUrlRTL>

  <GoImageActiveUrl xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/gosearch.gif</GoImageActiveUrl>

  <GoImageActiveUrlRTL xmlns="urn:schemas-microsoft-com:SearchBoxEx">/_layouts/images/goRTL.gif</GoImageActiveUrlRTL>

  <DropDownModeEx xmlns="urn:schemas-microsoft-com:SearchBoxEx">ShowDD</DropDownModeEx>

  <ScopeDisplayGroupName xmlns="urn:schemas-microsoft-com:SearchBoxEx">Search Dropdown</ScopeDisplayGroupName>

  <RegisterStyles xmlns="urn:schemas-microsoft-com:SearchBoxEx">true</RegisterStyles>

  <ShouldTakeFocusIfEmpty xmlns="urn:schemas-microsoft-com:SearchBoxEx">false</ShouldTakeFocusIfEmpty>

</WebPart>]]>

                  </AllUsersWebPart>

            </File>

      </Module>

</Elements> 

?????????????

1. ? ?????????? ?????? ?????????
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Bin
stsadm.exe -o installfeature -name CreatePageExample –force
2. ?? ??????? ????? ? Site Settings -> Site features ? ?????? ?? ?????? Activate ????? ? ????? ? ????????? Create Page Example

 

??????? ?????? : CreatePageExample.zip (0.1MB)

Comments

  • Anonymous
    January 01, 2003
    Учтем пожелание ;)

  • Anonymous
    July 30, 2007
    А можно как-нибуть уделить время "Рабочим процессам"? Хотелось бы побольше узнать интересностей по Рабочим процессам...

  • Anonymous
    September 27, 2007
    А можно ли при этом установить connection между двумя web-parts?