2011-04-26 51 views
1

我已經使用SharePoint 2010和Visual Studio 2010創建了一個事件接收器。事件接收器執行ItemDeleting,但它不能執行ItemAddingItemAdded事件。SPListItem事件接收器不執行ItemAdded事件

我的問題是我在編輯表單中上傳圖像,所以我想在添加新的項目後打開編輯表單,所以我假設我可以重定向到項目的添加事件中的編輯頁面。

<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>` 
+1

請發表您的事件接收器的Elements.xml的。 – 2011-04-26 17:20:23

回答

2

對於事件接收器火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$</Assembly>  
     <Class>ListDefinitions.ListsEventRecievers.SharedItemListEventReciever.SharedItemListEventReciever</Class> 
     <SequenceNumber>10000</SequenceNumber> 
     </Receiver> 

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

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

    </Receivers> 
</Elements> 

`