Unfortunately, it doesn't work properly with the answer I stated before because what it ends up doing is adding another version to your branch instead of creating another version in the main branch, I fixed this issue with this:
void GetVersions(string sourcefile)
{
ClearCase.CCElement element = m_CC.get_Element(sourcefile);
if (element != null)
{
ClearCase.CCVersion latestVersion = null;
FileInfo fi = new FileInfo(sourcefile);
latestVersion = element.get_Version();
if (latestVersion != null)
{
ClearCase.CCBranch branch = latestVersion.Branch;
ClearCase.CCCheckedOutFile file = latestVersion.CheckOut(ClearCase.CCReservedState.ccReserved, "", false, ClearCase.CCVersionToCheckOut.ccVersion_SpecificVersion, true, false);
string path = file.ExtendedPath;
}
}
}
void checkIn(string sourcefile)
{
ClearCase.CCElement element = m_CC.get_Element(sourcefile);
element.CheckedOutFile.CheckIn("", true, sourcefile, ClearCase.CCKeepState.ccKeep);
}
This way you can check it back in using your own branch to create another version for the main document. This is really important when using source control.