If you check out a file from a library on a site, make changes, and then decide you don't want to keep the changes that you made, you can undo the check-out. The changes that you made to the file since you checked it out are discarded, and the file is made available again for other people to edit.

now, want to do same thing bur grammatically...

1 Answer 1


You can use SPFile.UndoCheckOut to discard the changes.

  • Hi nadeem Will this Function Override The Checkout Done By Another User? Mar 17, 2015 at 9:02
  • @AXAY, it will not override the checkout of the other user if the user performing it is not an admin user. For this you may need to run the code using RunWithElevatedPreviliges Mar 17, 2015 at 9:13

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.