SPCheckedOutFile.TakeOverCheckOut Method
Instructs the site that another user account is taking over control of a currently checked-out file.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
| Exception | Condition |
|---|---|
| ArgumentException |
Url is null or empty. |
| SPException |
An error occurred during the attempt to take over control of the file. |
Permissions Issues
There are only 2 options for permissions:
- Run under the current context or impersonate a user
- This user must have list owner permissions
- The user who is running the code will take over the check-out
- RunWithElevatedPrivileges
- The file will be checked out to system account (SHAREPOINT\system) and unless programatically checked-in or deleted will be inaccessible from the UI.
- 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
- If new, the item will not show up in the document library and will be invisible unless you use: List Settings / Manage
- The file will be checked out to system account (SHAREPOINT\system) and unless programatically checked-in or deleted will be inaccessible from the UI.
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/
- 8/30/2011
- RobertRFreeman