capetownandre
Technical User
Trying to access a Borland starteam folder from within VBA.
Does anybody have any examples of how to navigate the API.
I can sucessfully connect, but am having trouble navigating from views to folders & Files
'/////////////////////////////////////////////////////
Sub CommandButton1_Click()
' comes in here
Dim strAddress As String
Dim nPort As Long
Dim strUser As String
Dim strPassword As String
Dim factory As New StServerFactory
Dim server As StServer
Dim sp As StProject
Dim sv As StView
If Not fng_connectstar(server, factory) Then
MsgBox "Unable to connect using supplied parameters"
End If
strName = "project"
If Not fn_getProject(strName, server, sp) Then
MsgBox " project not found"
End If
strName = "Viewname"
If Not fn_getView(strName, sp, sv) Then
MsgBox " view not found"
End If
cat = "mouse"
server.Disconnect
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fn_getProject
'Purpose:Check if the project exists
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fn_getProject(strproj, server As StServer, sp As StProject) As Boolean
For Each sp In server.Projects
If sp.Name = strproj Then
Exit For
End If
Next
Leave:
If sp.Name <> strproj Then
fn_getProject = False
Else
fn_getProject = True
End If
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fng_connectstar
'Purpose:Is connect to starteam
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fng_connectstar(server, factory) As Boolean
strAddress = "Ipadress"
nPort = port_number
strUser = username
strPassword = password"
fng_connectstar = False
Set server = factory.Create(strAddress, nPort)
server.Connect
' LogOn as a specific user.
server.logOn strUser, strPassword
If server.Connected Then
fng_connectstar = True
End If
Leave:
Set ClientRecord = Nothing
Set ClientCommand = Nothing
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fn_getView
'Purpose:Check if the view exists
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fn_getView(strName, sv As StView, sp As StProject) As Boolean
For Each sv In sp.Views
If sv.Name = strName Then
Exit For
End If
Next
Leave:
If sv.Name <> strName Then
fn_getView = False
Else
fn_getView = True
End If
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function
Does anybody have any examples of how to navigate the API.
I can sucessfully connect, but am having trouble navigating from views to folders & Files
'/////////////////////////////////////////////////////
Sub CommandButton1_Click()
' comes in here
Dim strAddress As String
Dim nPort As Long
Dim strUser As String
Dim strPassword As String
Dim factory As New StServerFactory
Dim server As StServer
Dim sp As StProject
Dim sv As StView
If Not fng_connectstar(server, factory) Then
MsgBox "Unable to connect using supplied parameters"
End If
strName = "project"
If Not fn_getProject(strName, server, sp) Then
MsgBox " project not found"
End If
strName = "Viewname"
If Not fn_getView(strName, sp, sv) Then
MsgBox " view not found"
End If
cat = "mouse"
server.Disconnect
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fn_getProject
'Purpose:Check if the project exists
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fn_getProject(strproj, server As StServer, sp As StProject) As Boolean
For Each sp In server.Projects
If sp.Name = strproj Then
Exit For
End If
Next
Leave:
If sp.Name <> strproj Then
fn_getProject = False
Else
fn_getProject = True
End If
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fng_connectstar
'Purpose:Is connect to starteam
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fng_connectstar(server, factory) As Boolean
strAddress = "Ipadress"
nPort = port_number
strUser = username
strPassword = password"
fng_connectstar = False
Set server = factory.Create(strAddress, nPort)
server.Connect
' LogOn as a specific user.
server.logOn strUser, strPassword
If server.Connected Then
fng_connectstar = True
End If
Leave:
Set ClientRecord = Nothing
Set ClientCommand = Nothing
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Name: fn_getView
'Purpose:Check if the view exists
'Called By:
'Author:Andre Nel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fn_getView(strName, sv As StView, sp As StProject) As Boolean
For Each sv In sp.Views
If sv.Name = strName Then
Exit For
End If
Next
Leave:
If sv.Name <> strName Then
fn_getView = False
Else
fn_getView = True
End If
Exit Function
Errorhandler:
'Call ErrorLog("modCase", "IsCaseOpen")
Resume Leave
End Function