×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need to track "links/shares" between projects/files...

Need to track "links/shares" between projects/files...

Need to track "links/shares" between projects/files...

(OP)
Hello

VSS stores information on every file and project - one is the "sharing" or "links" aspect.  This can be very useful, but if you run into a lot of projects that branch off eventually or certain files branch off, there is just no way to figure this out without looking at the properties of every file in every project.

What I am looking for is some sort of report or SQL interface so that I might write a query (even a command line script at this point) that will extract the information that I KNOW is being stored in VSS so that I can monitor projects for broken links, unexpected shares, and project management.  

ANY help with this would be greatly appreciated.  

I've done a lot of searching so far and I've not come up with much.  I found a 3rd party reporting tool (VSS Data Export) on www.windeveloper.com that exports your VSS database to an Access database and I'm playing around with that - but it only creates 4 tables and it doesn't seem to contain the information I am looking for.

Basically, I need a report that lists all files that have shares, and with whom they are shared, the relationship (parent/child) - also if an entire project (recursive) is shared, the same information for the project...

Does anyone know what I'm talking about?  

PLEASE HELP

Thanks so much!!!

Keri-Lyn

RE: Need to track "links/shares" between projects/files...

Hi Keri-Lyn,

Not 100% sure this will do you job, but should be a starting point at least for you. It is in VB6, so I hope that is OK. Just add a form with an OK button and add this code to it.

'=======================================================

Option Explicit
Dim objVSSDatabase As New VSSDatabase

Private Sub cmdOK_Click()
'
    'Open database using login and password
    objVSSDatabase.Open "\\192.0.0.3\vss\srcsafe.ini", "user", "password"
    
    'process initial source folder
    Call ProcessFolder("$\Source\Branch1")
    
'
End Sub

Private Sub ProcessFolder(ByVal StrSource As String)


Dim objVSSRoot As VSSItem
Dim objItems As VSSItem
Dim objItem As VSSItem
Dim intMaxVersion As Integer
Dim intLinkCount As Integer

    'open up the paths
    Set objVSSRoot = objVSSDatabase.VSSItem(StrSource, False)
'
    'Grab all the items from the Path
    For Each objItems In objVSSRoot.Items
        'Get the latest version number
        intMaxVersion = objItems.VersionNumber
        'Open file
        Set objItem = objItems.Version(intMaxVersion)
        
        'If folder then call this routine again with new path to process folder
        If objItem.Type = 0 Then
            Call ProcessFolder(StrSource & "\" & objItem.Name)
        End If
        
        'All files have one link, if mulitple the show paths where links are.
        If objItem.Links.Count > 1 Then
            For intLinkCount = 1 To objItem.Links.Count
                MsgBox objItem.Links.Item(intLinkCount).LocalSpec
            Next intLinkCount
        End If

    Next
    
    Set objVSSRoot = Nothing


End Sub
'=======================================================


Regards,


Hammy.

RE: Need to track "links/shares" between projects/files...

Soz,

Forgot you also need to add a reference to the VB6 app to Microsoft SourceSafe 6.0 Type Library. In my case this is
c:\program files\vss\win32\SSAPI.DLL


Hammy.

RE: Need to track "links/shares" between projects/files...

(OP)
Hi Hammy

Thank you so much for this piece of code.  I'm going to try to get this to work because the need to track shared files in projects is becoming extremely necessary - for example - today, we had an error in our build because a file had been added to the parent project (Project1).  We were building Project 2, which is "shared" with Project 1.  Unfortunately, when you add a new file to Project 1, it does not propagate to Project 2.  I had to go into Project 2 and manually share this file with it.

What kind of output should I expect from running this?  I'm not terribly familiar with VB6 but know enough to get around.  I'm more of a SQL gal, if only I could get the information I need exported to tables!  

Thank you thank you thank you!!  I'll let you know how it goes.  

KLM  

RE: Need to track "links/shares" between projects/files...

Hi Keri-Lyn,

Try this code, it will create a comma separated file called c:\ss.csv that you could import into SQL I am sure.
'=================================================
Option Explicit
Dim objVSSDatabase As New VSSDatabase
Dim intFreeFile As Integer

Private Sub cmdOK_Click()
'
    
    'Open database using login and password
    objVSSDatabase.Open "\\192.0.0.3\vss\srcsafe.ini", "user", "password"
    
    'process initial source folder
    intFreeFile = FreeFile
    Open "c:\SS.csv" For Output As #intFreeFile
    Call ProcessFolder("$\Source\Branch1")
    Close #intFreeFile
    
    Unload Me
'
End Sub

Private Sub ProcessFolder(ByVal StrSource As String)


Dim objVSSRoot As VSSItem
Dim objItems As VSSItem
Dim objItem As VSSItem
Dim intMaxVersion As Integer
Dim intLinkCount As Integer
Dim strLine As String

    'open up the paths
    Set objVSSRoot = objVSSDatabase.VSSItem(StrSource, False)
'
    'Grab all the items from the Path
    For Each objItems In objVSSRoot.Items
        'Get the latest version number
        intMaxVersion = objItems.VersionNumber
        'Open file
        Set objItem = objItems.Version(intMaxVersion)
        
        'If folder then call this routine again with new path to process folder
        If objItem.Type = 0 Then
            Call ProcessFolder(StrSource & "\" & objItem.Name)
        End If
        
        'All files have one link, if mulitple the show paths where links are.
        strLine = ""
        For intLinkCount = 1 To objItem.Links.Count
            If Trim$(objItem.Links.Item(intLinkCount).LocalSpec) <> "" Then
                strLine = strLine & objItem.Links.Item(intLinkCount).LocalSpec & ","
            End If
        Next intLinkCount
        
        Print #intFreeFile, strLine

    Next
    
    Set objVSSRoot = Nothing


End Sub

'=================================================

Regards,

Hammy.

RE: Need to track "links/shares" between projects/files...

(OP)
Hammy, you're a godsend!

We did get the code to work (funny, I couldn't get it to work in plain old VB, but it worked in Access using a form there...  strange!) anyway, figured the output was a message box (duh!) and we are looking and modifying it.  This is great!  "If you can't find the tool you're looking for, then make it yourself".  

Anyway, I just wanted to say thank you again for helping out a poor soul.  

You rock!
KLM

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close