How To Undo check-out and discard changes to a file grammatically?
Question
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...
Solution
You can use SPFile.UndoCheckOut
to discard the changes.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange