zoukankan      html  css  js  c++  java
  • (转)Quick Tip: Provisioning Web Parts to a Page(添加web part到page上,)

    原文:http://blogs.msdn.com/b/uksharepoint/archive/2011/04/04/provisioning-web-parts-to-a-page.aspx

    When deploying a page to SharePoint through a Modules feature, there are several options adding web parts to this. These are as follows:

    1. Add the web parts to the page programmatically via a feature receiver. This approach can be done quickly and easily if you are familiar with coding, however if the feature receiver fails, the web part page may continue to be checked out.
    2. Embed references to the web parts directly in the mark-up of the aspx page. The main problem with this approach is that once the page is deployed, the page is still “ghosted”. This means that the normal drop down to “Edit Web Part” is not shown, blocking future modifications to the page.
    3. The third approach (the preferred one), is to embed the webpart markup in “AllUsersWebPart” nodes in the modules elements.xml file (as shown in the example below).
    <?xml version="1.0" encoding="utf-8"?> 
      <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
        <Module Name="XYZCustomPages" RootWebOnly="True">
          <File Path="XYZCustomPagesHome.aspx" Url="Home.aspx" IgnoreIfAlreadyExists="true">
            <AllUsersWebPart WebPartZoneID="Left" WebPartOrder="1">
              <![CDATA[
                <?xml version="1.0" encoding="utf-8"?>
                  <webParts>
                    <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                      <metaData>
                        <type name="SolutionX.ProjectY.WebParts.MyWebPart, $SharePoint.Project.AssemblyFullName$" />
                        <importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage>
                      </metaData>
                      <data>
                        <properties>
                          <property name="Title" type="string">My WebPart</property>
                          <property name="Description" type="string">My WebPart for XYZ</property>
                          <property name="ListName" type="string">ExampleList</property>
                          <property name="RowLimit" type="string">5</property>
                        </properties>
                      </data>
                  </webPart>
                </webParts>
               ]]>
             </AllUsersWebPart>
          </File>
      </Module>
    </Elements>

    Cheers to Pete Mellish and Amardeep Bhogal, who i kicked around the pro's and con's with.

    以下是我的注意点:

      1.用SPD Copy 页面的内容,可以获取web part zone的ID

      2.从Web Part gallery里面download web part的definition,改后缀名为xml,可以拿到web part的xml定义.

      3.

        <properties>
                      <property name="AllowZoneChange" type="bool">True</property>
                      <property name="ExportMode" type="exportmode">All</property>
                      <property name="HelpUrl" type="string" />
                      <property name="Hidden" type="bool">False</property>
                      <property name="TitleUrl" type="string" />
                      <property name="Description" type="string">Remedy Monitoring Webpart</property>
                      <property name="AllowHide" type="bool">True</property>
                      <property name="AllowMinimize" type="bool">True</property>
                      <property name="Title" type="string">Remedy Monitoring</property>
                      <property name="ChromeType" type="chrometype">Default</property>
                      <property name="AllowConnect" type="bool">True</property>
                      <property name="Width" type="unit" />
                      <property name="Height" type="unit" />
                      <property name="HelpMode" type="helpmode">Navigate</property>
                      <property name="CatalogIconImageUrl" type="string" />
                      <property name="AllowEdit" type="bool">True</property>
                      <property name="TitleIconImageUrl" type="string" />
                      <property name="Direction" type="direction">NotSet</property>
                      <property name="AllowClose" type="bool">True</property>
                      <property name="ChromeState" type="chromestate">Normal</property>
                    </properties>

      

  • 相关阅读:
    MySQL基础之 排序与限制,聚合
    AWS服务学习
    SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-006-定义切面使用xml
    SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-005-定义切面使用@Aspect、@EnableAspectJAutoProxy、<aop:aspectj-autoproxy>
    SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-004-使用AspectJ’s pointcut expression language定义Pointcut
    SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-003-Spring对AOP支持情况的介绍
    SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-002-AOP术语解析
    SPRING IN ACTION 第4版笔记-第四章Aspect-oriented Spring-001-什么是AOP
    SPRING IN ACTION 第4版笔记-第三章ADVANCING WIRING-009-用SPEL给bean运行时注入依赖值
    SPRING IN ACTION 第4版笔记-第三章ADVANCING WIRING-008-SpEL介绍
  • 原文地址:https://www.cnblogs.com/PeterHome/p/3252922.html
Copyright © 2011-2022 走看看