添加具有多个类文件的 SharePoint 功能

发布于 2024-09-30 02:02:38 字数 1054 浏览 5 评论 0原文

我正在制作一个由多个项目组成的功能。

目前它包含一个具有 4 个 ElementManifest 条目的 Feature.xml 文件;两个用于特定内容类型(Field 定义和 FieldRef),一个用于某些 Web 部件,最后一个用于自定义页面布局。所有这些都运行良好。

我已使用内容类型 (FieldRefs) 更改了文件以添加接收器,因为我希望在通过 ItemAdding 功能接收器添加项目时进行处理。文件的该部分如下所示(我已删除程序集和类名称,但它们是正确的):

<XmlDocuments>
  <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
    <Receivers>
      <Receiver>
        <Name>NewsAlerts</Name>
        <Type>ItemAdding</Type>
        <SequenceNumber>10000</SequenceNumber>
        <Assembly>#AssemblyInfo#</Assembly>
        <Class>#NamespaceToClassFile#</Class>
        <Data></Data>
        <Filter></Filter>
      </Receiver>
    </Receivers>
  </XmlDocument>
</XmlDocuments>

除了此文件之外,我还使用自定义类文件来添加一些功能。对于 FeatureReceiver 类和自定义类文件,我是否需要向 feature.xml 或其他一些 xml 文件添加任何内容以确保包含它们?我希望将其全部添加到一起作为一项功能。

I am in the process of making a feature that consists of multiple items.

Currently it contains a Feature.xml file with 4 ElementManifest entries; two for a specific contenttype (Field definitions and FieldRefs), one for some webparts and the last is for a custom pagelayout. All of that is working fine.

I have altered the file with the contenttype (FieldRefs) to add a Receiver, since I wish to process whenever an item is added through the ItemAdding feature receiver. That part of the file looks as follows (I have removed the assembly and class names, but they are correct):

<XmlDocuments>
  <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/events">
    <Receivers>
      <Receiver>
        <Name>NewsAlerts</Name>
        <Type>ItemAdding</Type>
        <SequenceNumber>10000</SequenceNumber>
        <Assembly>#AssemblyInfo#</Assembly>
        <Class>#NamespaceToClassFile#</Class>
        <Data></Data>
        <Filter></Filter>
      </Receiver>
    </Receivers>
  </XmlDocument>
</XmlDocuments>

Besides this file, I use a custom class file to add some functionality. For both the FeatureReceiver class and the custom class file, do I need to add anything to feature.xml or some of the other xml files to make sure they are included? I want it all added together as ONE feature.

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

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

发布评论

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

评论(1

绮筵 2024-10-07 02:02:38

您的功能接收器组件和另一个都应该位于 GAC 中。您可以创建一个 SharePoint 解决方案来部署您的功能并将程序集放入 GAC 中,以便在安装解决方案时它们可用。

Both your feature receiver assembly and the other one should be in the GAC. You can create a SharePoint solution that deploys your feature and puts the assemblies in the GAC so that they are available when the solution is installed.

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