Knowledge Base

The leading provider of version control solutions and TWAIN SDKs

How to get the subproject list under a project using SourceAnywhere for VSS COM SDK?

In this article, we take a VB project as example.

1. Install SourceAnywhere for VSS COM SDK on your machine.

2. Please add "SAWVSDK.dll" to the project. In Visual Studio, click menu Project | Add Reference | Browse, browse to the SourceAnywhere for VSS COM SDK installation folder, highlight and select "SAWVSDK.dll"
, and click OK.

Note: There is some problem with the GetSubProjectsFromParent() function in the old version of SourceAnywhere for VSS COM SDK. Please download the attached internal version, replace the old one before using the code below.

3. You can use the ConnectToServer() function to connect to SourceAnywhere for VSS Server and use  Login() function to log into your account, and then use the GetSubProjectsFromParent() function to get the subproject list.

Here is a sample in VB:

Imports SAWVSDKLib

Public Class Form1
    Dim SdkObject As New SAWVSDKLib.SAWVSDK

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ConnectedToServer As Boolean
        Dim EncryptType As Enum_EncryptType
        Dim OnlyTrial As Boolean
        Dim LeftTrialDays As Long
        Dim Canceled As Boolean
        Dim ResultDescription As String

        Dim ResultValue As Long
        ResultValue = SdkObject.ConnectToServer("", 8877, ConnectedToServer, EncryptType, OnlyTrial, LeftTrialDays, Canceled, ResultDescription, 0, "", 0, "dynamsoft", "saw")
        If ResultValue <> 0 Then
            MsgBox("connection fail")
        End If

        Dim KeyInfoSet As New SAWVKeyInfoSet
        Dim MustChangePassword As Boolean
        Dim ExpireDays As Long

        Dim ResultValue1 As Long
        ResultValue1 = SdkObject.Login("dynamsoft", "saw", "common", KeyInfoSet, MustChangePassword, ExpireDays, Canceled, ResultDescription)

        If ResultValue1 <> 0 Then
            MsgBox("login fail" + ResultDescription)


            Dim ResultValue3 As Long

            Dim SubProjectSet As SAWVSubProjectsFromParentSet

            'Read all the subprojects under project "$/ServerProjectName" on server
            ResultValue3 = SdkObject.GetSubProjectsFromParent("$/", False, SubProjectSet, Canceled, ResultDescription)

            Dim ProjectTree As String

            If ResultValue3 = 0 Then
                'If it succeeds to call this method, display the information of the subproject
                Dim Count As Long
                Count = SubProjectSet.Count
                Dim Index As Long
                For Index = 0 To Count - 1
                    Dim SubProject As SAWVSubProjectsFromParent

                    SubProject = SubProjectSet.Item(Index)

                    ProjectTree += SubProject.SubProjectName
                    ProjectTree += vbLf


                MsgBox("Calling 'GetSubProjectsFromParent' function fails.")
            End If
        End If

    End Sub
End Class

Article Details

Last Updated
27th of October, 2009

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?

Thank you for rating this answer.

Related Articles

No related articles were found.


No attachments were found.