Hi everyone.
I got a problem unsolved almost 2 weeks. Please somebody tell me a clue.
I customized the SPItemEventReceiver and associated the customized SPItemEventReceiver with a content type was inherited from the Document Library content type and deployed this content type to a server as a Feature.
When I uploaded a file from Word 2007, Events associated with the ListItem fired. but on uploading using the Wss Object model , events did not fire at all.
I have a same experience when I using not only a document library type and SPFileCollection.Add method but also a list type and SPListItemCollection.Add method.
I have found the following from the WSS3.0 sdk document.
SPItemEventReceiver.ItemAdding event occurs in the following situations:
-
Default data is populated from a template.
-
New items are created using the browser user interface.
-
New items are added using the object model or Web service.
So, it seems to be possible to trigger the SPListItem adding event through the wss object model.
but i don't know how .
Here are my questions.
When does the event associated with a SPListItem fire
How can I trigger events associated with a SPListItem through the wss object model api
How can i make a customized SPItemEventReceiver work properly using the wss object model api

SPItemEventReceiver do not work properly when i use the wss object model API.
airin
Well, I did everything the same as you apart from steps 1-3 (my event handler wasnt content-type specific) so my guess this has to do with the content type.
Can you say if in the code (during SPListItemCollection.Add() ), can you specify the content type
Also, what happens if you build your event to all types and not a specific one maybe if we troubleshoot that way we will find something.
Keep me informed.
Rattlerr
Ishai Sagi.
I remarked the answer. I'm sorry for my mistake.
I really appreciate for your help and advice.
Have a nice day.
hye_heena
Well, what makes you sure that its not firing I have done event handlers using the SPItemEventReciever and they work both for OM entry and web interface entry.
I think your problem is that you are using "ItemAdding" which (by design) does not return any referance to the list item. This means that your event handler will fail if you try to use the list item object from the properties of the event. Try moving your code to the "ItemAdded" event.
kenlefeb
Hi. Ishai Sagi.
As you and wss3.0 SDK said, SPItemEventReceiver works. I have completely misunderstood the situation.
The problem that i have is concerned with debugging between VseWss and Windows application using wss OM.
Thanks for your reply. You are a lifesaver.
Bobal
Jeon,
you should mark the answer that you feel was most helpful as the answer, not your own...
laboremus
Hi. Ishai Sagi.
Thank for your reply.
My problem is that when i add a list Item to a list using OM entry, the list doesn't trigger any event assosiated with its not only ItemAdding event but also ItemAdded event.
It means events did not occur at all.
These are what i did.
1. I created a content type inherited from the default list type.
2. I associated a customized SPItemEventReceiver with the content type.
3. I deployed the content type to a server using Features
4. I created a list instance.
5. I added a Item using web interface and events fired properly
6. I created a window application which add a list item through the wss object model. in the code I add a list item using SPListItemCollection.Add() method.
I expected that when SPListItemCollection.Add() method is called, then the Item Adding event fired. but it didn't work.
Is there anything what i missed
I was wondering if I could see your sample code using OM entry to add a list item.