Microsoft Knowledge Base Email Alertz

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

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 909455 - Last Review: May 8, 2007 - Revision: 1.2

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

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 (http://msdn2.microsoft.com/en-us/library/b80a7e92(vs.71).aspx)

APPLIES TO
  • Microsoft Office SharePoint Portal Server 2003
  • Microsoft Windows SharePoint Services 2.0
Keywords: 
kbprb KB909455
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate