here is the recursive method i wrote (in C#) to get the histories of
all items in a project. it receives a VSSItem to start with, and a
file name to write the history to.
private void WriteVersions(IVSSItem root, String file) {
using (StreamWriter writer = new StreamWriter(file,false))
{
if (root.Type == (int)VSSItemType.VSSITEM_PROJECT) {
writer.WriteLine("*****Project " + root.Spec);
}
else {
writer.WriteLine("*****File " + root.Spec);
}
IVSSVersions versions = root.get_Versions((int)
VSSFlags.VSSFLAG_RECURSNO);
foreach (IVSSVersion ver in versions) {
writer.WriteLine(String.Format("{0,-3} {1,-22}
{2}",
ver.VersionNumber.ToString(),
ver.Date.ToString("G"),
ver.Action));
if (ver.Action.StartsWith("Labeled")) {
writer.Write("Label Comment: " +
ver.LabelComment);
writer.WriteLine("; Label: " + ver.Label);
}
else {
writer.WriteLine("Comment: " + ver.Comment);
}
writer.WriteLine("Name: " + ver.VSSItem.Name);
writer.WriteLine("Spec: " + ver.VSSItem.Spec);
}
if (root.Type == (int)VSSItemType.VSSITEM_PROJECT) {
IVSSItems childItems = root.get_Items(true);
foreach (IVSSItem child in childItems) {
WriteVersions(child, file);
}
}
}
}
the VSSItem.Name and Spec return the values for the project being
listed, and not the deleted item. the delete version is printed like
this:
29 1/11/2006 2:37:14 PM Deleted
Comment:
Name: H2 Sources
Spec:$/H2 Sources
where "H2 Sources" is the project which is being iterated in the loop
(and that contained the deleted item).
thanks for any help
tsahi