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...


You can use SPFile.UndoCheckOut to discard the changes.

| improve this answer | |
  • Hi nadeem Will this Function Override The Checkout Done By Another User? – Akshay Dattatray Nangare Mar 17 '15 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 – Nadeem Yousuf-AIS Mar 17 '15 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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