通过功能将 Web 部件添加到默认 WSS 页面

发布于 2024-07-14 04:29:30 字数 333 浏览 4 评论 0原文

我开发了一个自定义 Web 部件。 我想创建一个功能,当通过 STSADM 激活时,会将 Web 部件添加到 WSS 站点的默认页面。 希望这可以在不编写代码的情况下完成。

此 Web 部件旨在部署到 Web 应用程序的 bin 目录,并且必须将 featurereceiver 安装到 GAC。 AllUsersWebPart 元素看起来很有希望,但我不知道如何让它发挥作用。

TIA,

jt

I've developed a custom web part. I would like to create a feature that when activated via STSADM adds the web part to the default page of a WSS Site. Hopefully this can be done without writing code.

This webpart is meant to de deployed to the web application's bin directory and featurereceiver must be installed to the GAC. The AllUsersWebPart element looks promising, but I can't figure out how to get it to work.

TIA,

jt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮萍、无处依 2024-07-21 04:29:30

AllUsersWebPart 标记允许我们插入一个 Web 部件,并使用 WebPartOrder 和 WebPartZone 属性将其放置在我们想要的位置。 标记的内容是您的 Web 部件的 dwp(或 Web 部件)。 例如,对于 dwp:

<AllUsersWebPart WebPartZoneID="MiddleLeftZone" WebPartOrder="0">
    <![CDATA[                                              
      <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
        <FrameType>None</FrameType>
        <AllowMinimize>true</AllowMinimize>
        <IsVisible>true</IsVisible>
        <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
        <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
        <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
        <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
          <Value><iframe src="$Resources:Summary_Url;" frameborder="0" scrolling="no" width="100%" height="100%"></iframe></Value>
        </Content>
        <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
    </WebPart>
    ]]>
  </AllUsersWebPart>

对于 webpart:

<AllUsersWebPart WebPartZoneID="MiddleLeftZone" WebPartOrder="1">
    <![CDATA[                                              
      <webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
          <metaData>
            <type name="MyClass, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f3b9d1137704f880" />
            <importErrorMessage>No se puede importar este elemento Web.</importErrorMessage>
          </metaData>
          <data>
            <properties>
              <property name="AllowClose" type="bool">False</property>
              <property name="AllowMinimize" type="bool">False</property>
              <property name="AllowConnect" type="bool">True</property>
              <property name="ChromeType" type="chrometype">None</property>
              <property name="Hidden" type="bool">False</property>
              <property name="AllowEdit" type="bool">False</property>
              <property name="AllowZoneChange" type="bool">False</property>
              <property name="MissingAssembly" type="string">No se puede importar este elemento Web.</property>
              <property name="ChromeState" type="chromestate">Normal</property>
            </properties>
          </data>
        </webPart>
      </webParts>
    ]]>
  </AllUsersWebPart>

我以前没有尝试过,但我认为一旦创建了 web 就可以完成。 尝试一下并告诉我们。

The AllUsersWebPart tag allow us to insert one webpart and place it where we want using WebPartOrder and WebPartZone attributes. The content of the tag is the dwp (or webpart) of your webpart. For example, for a dwp:

<AllUsersWebPart WebPartZoneID="MiddleLeftZone" WebPartOrder="0">
    <![CDATA[                                              
      <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
        <FrameType>None</FrameType>
        <AllowMinimize>true</AllowMinimize>
        <IsVisible>true</IsVisible>
        <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
        <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
        <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
        <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
          <Value><iframe src="$Resources:Summary_Url;" frameborder="0" scrolling="no" width="100%" height="100%"></iframe></Value>
        </Content>
        <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
    </WebPart>
    ]]>
  </AllUsersWebPart>

For a webpart:

<AllUsersWebPart WebPartZoneID="MiddleLeftZone" WebPartOrder="1">
    <![CDATA[                                              
      <webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
          <metaData>
            <type name="MyClass, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f3b9d1137704f880" />
            <importErrorMessage>No se puede importar este elemento Web.</importErrorMessage>
          </metaData>
          <data>
            <properties>
              <property name="AllowClose" type="bool">False</property>
              <property name="AllowMinimize" type="bool">False</property>
              <property name="AllowConnect" type="bool">True</property>
              <property name="ChromeType" type="chrometype">None</property>
              <property name="Hidden" type="bool">False</property>
              <property name="AllowEdit" type="bool">False</property>
              <property name="AllowZoneChange" type="bool">False</property>
              <property name="MissingAssembly" type="string">No se puede importar este elemento Web.</property>
              <property name="ChromeState" type="chromestate">Normal</property>
            </properties>
          </data>
        </webPart>
      </webParts>
    ]]>
  </AllUsersWebPart>

I haven't tried before but I think it can be done once the web has been created. Try it and tell us.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文