The following code is the C# example for setting an active repository.
VaultRepositoryInfo[] reps = null;
//List all the repositories on the server.
client.ListRepositories(ref reps);
//Search for the one that we want.
foreach (VaultRepositoryInfo r in reps)
{
if (String.Compare(r.RepName,repositoryName, true) == 0)
{
//This will load up the client side cache files and refresh the repository structure.
//See http://support.sourcegear.com/viewtopic.php?t=6 for more on client side cache files.
client.SetActiveRepositoryID(r.RepID, client.Connection.Username, r.UniqueRepID, true, true);
break;
}
}
The following code is my attempt to convert it to VB.NET. I do not seem to have all of the information I need to convert this correctly. There seem to be variable declarations that I must make which I can only guess at what datatype or object they must be. I am using VS.NET 2002, framework 1.0 and Vault 2.0.3. Can you help?
Dim reps As VaultClientOperationsLib.VaultClientRepository
'???Dim r As VaultClientOperationsLib.VaultClientRepository
Dim ref As Array()
Dim repositoryName As String
fobjMyClientDev.ListRepositories(ref) ', reps)
'Search for the one that we want by name.
For Each r In reps
' If it matches...
If (String.Compare(r.RepName, repositoryName, True) = 0) Then
' Set this as the active repository.
fobjMyClientDev.SetActiveRepositoryID( _
r.RepID, _
fobjMyClientDev.Connection.Username, _
r.UniqueRepID, _
True, _
True)
Exit Sub 'break()
End If
Next
If (fobjMyClientDev.ActiveRepositoryID = -1) Then
Throw New Exception("Repository not found.")
End If
Client API - SetActiveRepository
Moderator: SourceGear
ISBE:
I'm assuming you are connecting as a client. If so, most of the types used will be found in VaultClientNetLib.ClientService{}. If you browse the VaultClientNetLib.ClientService dll, you should see types to use.
For your example, try using:
' the repository info array
Dim reps As VaultClientNetLib.ClientService.VaultRepositoryInfo()
' now ask the server for a list of repositories.
ci.ListRepositories(ByRef ref)
Hope that helps.
I'm assuming you are connecting as a client. If so, most of the types used will be found in VaultClientNetLib.ClientService{}. If you browse the VaultClientNetLib.ClientService dll, you should see types to use.
For your example, try using:
' the repository info array
Dim reps As VaultClientNetLib.ClientService.VaultRepositoryInfo()
' now ask the server for a list of repositories.
ci.ListRepositories(ByRef ref)
Hope that helps.
Linda Bauer
SourceGear
Technical Support Manager
SourceGear
Technical Support Manager