0

We have some files that have been dragged into a library via explorer view. Before doing so, someone forgot to set a column to not be mandatory. Because of this they are checked out with no previous version. There are 10k of these docs!

What I need to do is to take ownership of the docs.

I have tried $Item.File.TakeOverCheckIn('Checked in by admin')

But either nothing happens or I get a message saying that SPFile does not have a method called TakeOverCheckIn

I have Googled and this is where I saw PS examples quoting TakeOverCheckIn()

1 Answer 1

1

I have resolved it, I needed to iterate through CheckedOutFiles rather than Items. Here is the code that did it for me, took over check out and then checked them in

ForEach($item in $doclib.checkedoutfiles){ 
    $item.TakeoverCheckout()
    $doclib.GetItemById($item.ListItemId).file.CheckIn("Checked in by Admin") 
    #write-host "$($item.LeafName) has been checked in" 
} 

Your Answer

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

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