2

I have a document library with 200 + documents. I would like to check out all documents in the library to the document owner. I have seen a few powershell scripts that check in documents but not out. Has anyone had any experience of this?

Also is there a way to automatically checkout the document when uploaded to the library?

1 Answer 1

1

Automatic check out can be done by ItemEventReceiver on ItemAdded event: http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx

if you saw the scripts for check in, it is similar to check out. You just have to run the script under the user to whom should be the files checked out or you can impersonate:

$user=$web.AllUsers.GetByID(1073741823);
$token = $user.UserToken;
$impWebObj = New-Object Microsoft.SharePoint.SPSite($web.Url, $token);
$imperWeb = $impWebObj.OpenWeb();
$list = $imperWeb.Lists["My List"]

# do the checkout for all files in library
$list.Items | % { $_.File.Checkout() }
$imperWeb.Close();

http://sharing-the-experience.blogspot.de/2011/04/powershell-and-sharepoint-impersonation.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.