In this article, I am going show how to delete all the document versions details from SharePoint document library.
private void DeleteAllVersion(){try{DialogResult dr = MessageBox.Show("Are you sure you want to send all provious versions associated with this file to the site Recycle Bin?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question);if (dr == DialogResult.Yes){SPSite Site = new SPSite(requestUrl);using (SPWeb web = Site.OpenWeb()){SPList list = web.Lists[DocLibrary];SPListItem item = list.GetItemById(DocumentID);SPListItemVersionCollection Fileversioncollection = item.Versions;Fileversioncollection.RecycleAll();MessageBox.Show("Document versions have been successfully deleted.", "Message");}}}catch (Exception ex){MessageBox.Show(ex.Message, "Message");return;}}