I would like to use Core Service to uninstall previous versions of a component, keeping only the latest version. How can i do this?
The documentation says about the Delete method: "Permanently deletes an element or a specific version of an element from the system"
This way you can delete versions by passing versions in the uri (e.g. tcm: 2-123-64-v4).
Tridion is shipped by default with the Cleanup Tool , which you can use for this purpose.
There is a visual interface , but also, if you have business requirements for this programmatically or as a scheduled task, it also provides a command line interface .