Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Controlling visual source safe through visual basic 6.0

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
vijayabadve
Asked:
vijayabadve
1 Solution
 
gencrossCommented:
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
 
gencrossCommented:
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
 
mlmccCommented:
listening
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
vijayabadveAuthor Commented:
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
 
gencrossCommented:
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
 
vijayabadveAuthor Commented:
Excellent. That's fantastic.
Now let me try to get files for a particular label only.
Could you please help me in that ?
0
 
vijayabadveAuthor Commented:
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
 
gencrossCommented:
By label to you mean file name?
0
 
vijayabadveAuthor Commented:
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
 
gencrossCommented:
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
 
AzraSoundCommented:
0
 
DanRollinsCommented:
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
 
Computer101Commented:
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now