如何为基于自定义内容类型的单个列表创建事件接收器?

发布于 2024-12-04 14:22:22 字数 309 浏览 2 评论 0原文

我正在尝试为我创建的名为“问题”的列表创建一个事件接收器。

当添加新问题时,我希望触发一个事件。我已经研究过它,所以我知道我需要创建一个事件接收器并使用 ItemAdded 方法。

如何将其绑定到列表的一个实例以及在创建接收器时为源类型选择什么?我在那里没有“自定义列表”选项 一些博客文章建议。

希望有人能提供帮助..

I am trying to create an event receiver for a list I have created called Questions.

When a new question is added I want an event to fire. I have looked into it so I know I need to create an event receiver and make use of the ItemAdded method.

How do I bind this to one instance of a list and what do I select for the Source type when creating the receiver? I don't have an option for "Custom List" in there as some blog posts suggest.

Hope someone can help..

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

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

发布评论

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

评论(2

记忆里有你的影子 2024-12-11 14:22:22

我想这可能就是您想要的:(http://msdn.microsoft.com/en-us/library/ff407249.aspx)

using (SPSite site = new SPSite("http://localhost")) 
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["Shared Documents"];

        SPEventReceiverDefinition def = list.EventReceivers.Add();

        def.Assembly = "ERDefinition, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=704f58d28567dc00";
        def.Class = "ERDefinition.ItemEvents";
        def.Name = "ItemAdded Event";
        def.Type = SPEventReceiverType.ItemAdded;
        def.SequenceNumber = 1000;
        def.Synchronization = SPEventReceiverSynchronization.Synchronous;
        def.Update();
    }
}

问候,

乔尔

-

http://joelblogs.co.uk

@joelblogs

I think this might be what you're after: (http://msdn.microsoft.com/en-us/library/ff407249.aspx)

using (SPSite site = new SPSite("http://localhost")) 
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["Shared Documents"];

        SPEventReceiverDefinition def = list.EventReceivers.Add();

        def.Assembly = "ERDefinition, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=704f58d28567dc00";
        def.Class = "ERDefinition.ItemEvents";
        def.Name = "ItemAdded Event";
        def.Type = SPEventReceiverType.ItemAdded;
        def.SequenceNumber = 1000;
        def.Synchronization = SPEventReceiverSynchronization.Synchronous;
        def.Update();
    }
}

Regards,

joel

--

http://joelblogs.co.uk

@joelblogs

乄_柒ぐ汐 2024-12-11 14:22:22

如果您不想使用代码来执行此操作,请尝试 SP EventHandler Manager

If you don't want to do it using code, try the SP EventHandler Manager

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