Tuesday, November 22, 2005

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();

No comments: