1

I got following error when I tried to Checkin files wich are Checked out by other users using powershell.

Exception calling "CheckIn" with "2" argument(s): "You cannot checkin and overwrite a published file." At C:\Users\administrator\Desktop\Test2.ps1:71 char:13 + $ListItems[$i].File.CheckIn("Checkin automatically",[Microsoft.Share ...

This is Powershell code:

 if($ListItems[$i].File.CheckOutStatus -ne "None")
 {
     $ListItems[$i].File.CheckIn("Checkin automatically",[Microsoft.SharePoint.SPCheckinType]::OverwriteCheckIn)
 }

How I checkin files forcefully that are checked out by other users for a long time using powershell?

1 Answer 1

1

Consider your current version of the file is 4.1 - you can check out this document and after you are done updating it you can check in with overwrite the draft (minor) version

But if you start with a published (major) version 4.0 and you check it out - then the overwrite check in is not possible

you can see this in the SharePoint UI as well - if you check out a published version of a document and immediately after that click the check in menu item - in the check-in page the overwrite check in option is missing.

Referred from OverwriteCheckIn Not Working

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.