Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Controlling visual source safe through visual basic 6.0

Posted on 2002-07-09
Medium Priority
Last Modified: 2013-11-25
I want to write a code in VB to get files with a particular label under a VSS project (VSS lying on a server on network) and check all these files found in a new project.
Question by:vijayabadve
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 7140465
You will want to reference the VSS object.  It is called Microsoft Sourcesafe 6.0 type library (or whatever version you have.  It should be there if you are using Source Safe from your machine.  I will try to work on some code for you.


Accepted Solution

gencross earned 400 total points
ID: 7140528
Here is a little code snippet that will open the VSS database.  You can then access the project(s) you need.

It is the best I can do at the moment.  It should give you something to go on.  Let me know if you need further assistance.

Dim objVSS As VSSDatabase
Set objVSS = New VSSDatabase
objVSS.Open "\\server1\ddrive\vb\vss\srcsafe.ini"
(use the path to your srcsafe.ini file)
LVL 101

Expert Comment

ID: 7140532
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 7140563
Many thanks for the code to start with.
But still my problems remains.
I want to access a particular project in VSS and get all
the files with a particular (Say release 4.4) label.
Then add these files in a new project.

Awaiting for the further help.
I am also trying to achieve this with the startup code.
So I am grateful to GENCROSS for the help.

Expert Comment

ID: 7140604
Here is some more code I just worked up that should show you have to do what you want.

Dim objVSS As VSSDatabase

Dim objItem As VSSItem
Dim objFile As VSSItem
Dim objNewItem As VSSItem
Dim objRoot As VSSItem

Set objVSS = New VSSDatabase

'Open SS database
objVSS.Open "\\server1\ddrive\vb\vss\srcsafe.ini"

'Open specific project
'To open a subproject just add it to the path ("$/TestProj/NewProj")
Set objItem = objVSS.VSSItem("$/TestProj", False)

'Cycle through all files in the project
For Each objFile In objItem.Items

    Debug.Print objFile.Name

'Create new project under the existing project
Set objNewItem = objItem.NewSubproject("NewProj", "Test proj")

'Or you can create new project in the root
Set objRoot = objVSS.VSSItem("$/", False)
Set objNewItem = objRoot.NewSubproject("NewProj", "Test proj")

Let me know if you need more help

Author Comment

ID: 7140620
Excellent. That's fantastic.
Now let me try to get files for a particular label only.
Could you please help me in that ?

Author Comment

ID: 7140628
Also the problem is , I know the roll directory name . I don't know how many sub directories are there inside it.
I just wanna dig the projects and get files under those with the label say "A" and share these files in a new directory

Expert Comment

ID: 7140649
By label to you mean file name?

Author Comment

ID: 7140664
No. One can assign a label to a particular version of a file. Say my main project has some subdirectories. There are different files under these different subdirectories. Some files have been labelled as 'Version 4.4'. Now I want to get all the files with labels 'Version 4.4' only. I don't want to get files not having this label. If you right click on a file and see history , you can see labels. You can lable a file by using label icon on the toolbar of VSS. I hope I could convey the question. Please ask me if I have failed.

Expert Comment

ID: 7140719
It becomes a little more complicated when you don't know the projects or how many sub projects there are you are going to want to recurse through all the sub projects.  I have found a good example of this at PSC.

There is also another problem.  I don't think you are going to be able to retrieve the label of the file.  You can set the label and comment from code, but do not think you can get it.
LVL 28

Expert Comment

ID: 7141148
LVL 49

Expert Comment

ID: 8002223
Hi vijayabadve,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept gencross's comment(s) as an answer.

vijayabadve, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 8094205
Comment from expert accepted as answer

E-E Admin

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question