SPListItem 事件接收器不执行 ItemAdded 事件

发布于 2024-11-03 09:12:32 字数 855 浏览 1 评论 0原文

我使用 SharePoint 2010 和 Visual Studio 2010 创建了一个项目事件接收器。该事件接收器执行 ItemDeleting 但无法执行 ItemAddingItemAdded > 事件。

我的问题是我在编辑表单中上传该项目的图像,因此我想在添加新项目后打开编辑表单,因此我假设我可以在该项目的“已添加”事件中重定向到编辑页面。

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
   <Receivers ListTemplateId="10002">
      <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemDeleting</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>     
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
    </Receivers>
 </Elements>`

I've created an item event receiver using SharePoint 2010 and Visual Studio 2010. The event receiver executes ItemDeleting but it can't execute ItemAdding or ItemAdded events.

My problem is I upload images for the item in edit form so I want to open the edit form after adding the new item, So I assume that I can make redirect to the edit page in the Added event of the item.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
   <Receivers ListTemplateId="10002">
      <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemDeleting</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>     
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>
    </Receivers>
 </Elements>`

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

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

发布评论

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

评论(1

时光清浅 2024-11-10 09:12:32

对于事件接收器触发 ItemAdding 和 ItemAdded,您需要更改 elements.xml,如下所示:

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
   <Receivers ListTemplateId="10002">
      <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemDeleting</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>     
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

     <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemAdding</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

     <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemAdded</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>     
        <Class>ListDefinitions.ListsEventRecieverSharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

    </Receivers>
 </Elements>

`

For event receiver fire ItemAdding and ItemAdded, you need to change elements.xml as follow:

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
   <Receivers ListTemplateId="10002">
      <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemDeleting</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>     
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

     <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemAdding</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>
        <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

     <Receiver>
        <Name>SharedItemListEventRecieverItemDeleting</Name>
        <Type>ItemAdded</Type>
        <Assembly>$SharePoint.Project.AssemblyFullName
lt;/Assembly>     
        <Class>ListDefinitions.ListsEventRecieverSharedItemListEventReciever.SharedItemListEventReciever</Class>
        <SequenceNumber>10000</SequenceNumber>
      </Receiver>

    </Receivers>
 </Elements>

`

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