event handler: Cannot complete this action

I made an event handler for doclibs to log the document updating and deletion activities. After deployment, the event handler for document library was logging the delete event but giving the exception on update event: “Cannot Complete this action, Please try again.”
After much effort, I found that the problem was with WSS Service Pack 2, and the exception was raised when try to access SPListItem collection.
The issue was because of increased security with WSS sp2.
http://support.microsoft.com/default.aspx?scid=kb;en-us;909455

The resolution is
using System.Security.Principal …
WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate();
//implement OM code here
wic.Undo();

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

%d bloggers like this: