Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting deleted files with sourcesafe automation (interop dll)

15 views
Skip to first unread message

Tsahi Asher

unread,
Jan 26, 2010, 3:53:17 PM1/26/10
to
hi,
i'm trying to get a history of a project in VSS using the VSS API. i
generated a managed code .dll using tlbimp.exe from my VSS 6.0d
ssapi.dll. the problem is this: when going over the VSSVersions
collection of a VSSItem which is a project (folder), i can see some
VSSVersion objects with the Deleted action. however, i have no
information about what was deleted. there is no record in any of the
child items of the project that they were deleted. using the GUI, when
viewing the history of a project, i can see the name of the deleted
item in the Name column where the Action is Deleted, but i don't know
how to get this name by code.

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

0 new messages