Microsoft KB Archive/909455

= Document library event handlers that use object model code without explicit impersonation fail with the &quot;Cannot complete this action&quot; error message after Windows SharePoint Services Service Pack 2 is installed =

Article ID: 909455

Article Last Modified on 5/8/2007

-

APPLIES TO


 * Microsoft Office SharePoint Portal Server 2003
 * Microsoft Windows SharePoint Services

-





SYMPTOMS
After you install Microsoft Windows SharePoint Services (WSS) Service Pack 2 (SP2), the document library event handlers that use object model code without explicit impersonation fail. Additionally, you receive the following error message.

Cannot complete this action



CAUSE
In the versions of Microsoft Windows SharePoint Services that are earlier than Windows SharePoint Services SP2, you could write a document library event handler that used the object model without explicit impersonation to access Windows SharePoint Services. However, you could only use this kind of implicit call if the application pool identity was a user who had sufficient rights to make object model calls.

In Windows SharePoint Services SP2, security has been increased in such a way that this kind of call is no longer possible. Therefore, you receive an error message if you try to perform this kind of call.



WORKAROUND
All document library event handlers must perform explicit impersonation to use Windows SharePoint Services object model calls. If the application pool identity has sufficient rights to make Windows SharePoint Services object model calls, you can use a code that impersonates the current user. The following code is an example of this kind of code: using System.Security.Principal

...

WindowsImpersonationContext wic = WindowsIdentity.GetCurrent.Impersonate;

//implement OM code here

wic.Undo;



STATUS
This behavior is by design.



MORE INFORMATION
For more information about impersonating and reverting, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/b80a7e92(vs.71).aspx

Keywords: kbprb KB909455

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.