This topic has not yet been rated - Rate this topic

SPCheckedOutFile.TakeOverCheckOut Method

Instructs the site that another user account is taking over control of a currently checked-out file.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public void TakeOverCheckOut()
Exception Condition
ArgumentException

Url is null or empty.

SPException

An error occurred during the attempt to take over control of the file.

The file must be checked out and have no checked-in draft or published version.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Permissions Issues

There are only 2 options for permissions:

  1. Run under the current context or impersonate a user
    1. This user must have list owner permissions
    2. The user who is running the code will take over the check-out
  2. RunWithElevatedPrivileges
    1. The file will be checked out to system account (SHAREPOINT\system) and unless programatically checked-in or deleted will be inaccessible from the UI.
      1. If new, the item will not show up in the document library and will be invisible unless you use: List Settings / Manage
        files which have no checked in version

The BUG here is that there is no way to assign a checked out file to a specific user (current or impersonated) who is only a contributor.  The only possible solution is to temporarily grant that user access (difficult and not recommended).

See the following thread for more info:
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/a308c900-ef7f-458f-a3e3-dba4887934e9/