添加具有多个类文件的 SharePoint 功能
我正在制作一个由多个项目组成的功能。
目前它包含一个具有 4 个 ElementManifest
条目的 Feature.xml 文件;两个用于特定内容类型(Field
定义和 FieldRef
),一个用于某些 Web 部件,最后一个用于自定义页面布局。所有这些都运行良好。
我已使用内容类型 (FieldRef
s) 更改了文件以添加接收器,因为我希望在通过 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 FieldRef
s), 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 (FieldRef
s) 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的功能接收器组件和另一个都应该位于 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.