Problems with SharePoint List Item Events

Anyone who has had to develop a SharePoint event handler has probably run into some trouble. This path is fraught with danger and as far as I can see the general advice when coming up against an issue is “gorn work around it and leave me alone”. So here are some links and tips for getting past the usual suspects:

Event Trouble Shooting  -is this a known problem or are you just “Special”

Codeplex Handler Management Page – this is a handy feature that allows you to see what handlers are associated with a site, list, content type..

Everything Eventful – great post for Getting Started with SharePoint events.  Everything from writing a receiver to attaching and troubleshooting.

Tip – When in doubt, used ED events instead of ING events. Make sure you do some of this though:

 bool auu = web.AllowUnsafeUpdates;
                web.AllowUnsafeUpdates = true;

….. do stuff to handle the event

 this.DisableEventFiring();
                    item.SystemUpdate(false);
                    this.EnableEventFiring();
                    web.AllowUnsafeUpdates = auu;

Tip- Document libraries are a bit different from standard lists. Mainly because when a document is uploaded, there are 2 sets of events. You will notice that when you upload a document, if you click Cancel at the Edit Form (complete doc metadata stage), the document will still appear in the library. So the itemadding, added, updating, updated events have fired already. When you complete the metadata for the document, they fire a second time.

Tip- Check your fields are A-OK. If you have a faulty field definition deployed uisng a feature it may have an invalid attribute that was not revealed when it was deployed. Sometimes this can cause items to ignore new property values altogether. Try removing custom fields and updating/adding items to see if the problem persists.

Other oddities

Happy Handling.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s