Solved

Controlling visual source safe through visual basic 6.0

Posted on 2002-07-09
13
237 Views
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.
0
Comment
Question by:vijayabadve
13 Comments
 
LVL 4

Expert Comment

by:gencross
Comment Utility
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.

0
 
LVL 4

Accepted Solution

by:
gencross earned 100 total points
Comment Utility
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)
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
listening
0
 

Author Comment

by:vijayabadve
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:gencross
Comment Utility
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
           
Next

'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
0
 

Author Comment

by:vijayabadve
Comment Utility
Excellent. That's fantastic.
Now let me try to get files for a particular label only.
Could you please help me in that ?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:vijayabadve
Comment Utility
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
0
 
LVL 4

Expert Comment

by:gencross
Comment Utility
By label to you mean file name?
0
 

Author Comment

by:vijayabadve
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:gencross
Comment Utility
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.

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=3273&lngWId=1

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.
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now