2016-12-02 340 views

回答

0

在SourceSafe API(Microsoft.VisualStudio.SourceSafe.Interop爲VSS2005或SourceSafeTypeLib在SSAPI.DLL爲VSS6)公開了大量的methods and properties您可以使用通過VS項目枚舉,檢查每個項目,並閱讀該項目歷史。從那裏你可以檢查哪個用戶加入了item history

下面是一些示例VB.NET代碼,它將枚舉項目中項目的版本。

Sub CheckVSS 
    Dim project As VSSItem 
    Dim vssDB As VSSDatabase 
    vssDB = New VSSDatabase 
    vssDB.Open(sourceSafeIniPath, vssUsername, vssPassword) 

    project = _vssDB.VSSItem(vssProjectFolder) 
    GetHistory(project) 

End Sub 

Sub GetHistory(ByVal item As VSSItem) 

    '--Enumerate through each version of this item. 
    For Each ver As VSSVersion In item.Versions 
     Debug.Print("{0}, {1}, {2}, {3}", item.Name, item.Spec, ver.Username, ver.Comment) 
    Next 

    '--Recursively enumerate through each item in this folder and child folders. 
    For Each subitem As VSSItem In item.Items 
     For Each ver As VSSVersion In subitem.Versions 
      Debug.Print("{0}, {1}, {2}, {3}", subitem.Name, subitem.Spec, ver.Username, ver.Comment) 
     Next 
     GetHistory(subitem) 
    Next 

End Sub