QuickOPC User's Guide and Reference
BrowseBranches(IEasyDAClient,String,String) Method
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.DataAccess Namespace > IEasyDAClientExtension Class > BrowseBranches Method : BrowseBranches(IEasyDAClient,String,String) Method
The client object that will perform the operation.
Name of the machine (empty string for local computer).
Contains ProgID of the OPC server to browse.
Browses the specified branch (or root) in OPC server's address space, and returns information about child branches found. Browse for child branches at the root. Specify machine name, and server class.
Syntax
'Declaration
 
<ExtensionAttribute()>
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function BrowseBranches( _
   ByVal client As IEasyDAClient, _
   ByVal machineName As String, _
   ByVal serverClass As String _
) As DANodeElementCollection
'Usage
 
Dim client As IEasyDAClient
Dim machineName As String
Dim serverClass As String
Dim value As DANodeElementCollection
 
value = IEasyDAClientExtension.BrowseBranches(client, machineName, serverClass)
[Extension()]
[ElementsNotNull()]
[NotNull()]
public static DANodeElementCollection BrowseBranches( 
   IEasyDAClient client,
   string machineName,
   string serverClass
)
[Extension()]
[ElementsNotNull()]
[NotNull()]
public:
static DANodeElementCollection^ BrowseBranches( 
   IEasyDAClient^ client,
   String^ machineName,
   String^ serverClass
) 

Parameters

client
The client object that will perform the operation.
machineName
Name of the machine (empty string for local computer).
serverClass
Contains ProgID of the OPC server to browse.

Return Value

The method returns a keyed collection of OpcLabs.EasyOpc.DataAccess.AddressSpace.DANodeElement values, each containing information about a particular branch found. The keys of the keyed collection are the names of the branches.
Exceptions
ExceptionDescription
Thrown when the OPC operation fails.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Example
// This example shows how to obtain all branches at the root of the address space. For each branch, it displays whether 
// it may have child nodes.

using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.AddressSpace;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClient
{
    class BrowseBranches
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();
            DANodeElementCollection branchElements;
            try
            {
                branchElements = client.BrowseBranches("", "OPCLabs.KitServer.2", "");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (DANodeElement branchElement in branchElements)
                Console.WriteLine($"BranchElements(\"{branchElement.Name}\").HasChildren: {branchElement.HasChildren}");
        }


        // Example output:
        //
        //BranchElements("$ServerControl").HasChildren: True
        //BranchElements("Boilers").HasChildren: True
        //BranchElements("Simulation").HasChildren: True
        //BranchElements("SimulateEvents").HasChildren: True
        //BranchElements("Trends").HasChildren: True
        //BranchElements("Demo").HasChildren: True
        //BranchElements("Greenhouse").HasChildren: True
    }
}
Rem This example shows how to obtain all branches at the root of the address space. For each branch, it displays whether 
Rem it may have child nodes.

Option Explicit

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Dim BranchElements: Set BranchElements = Client.BrowseBranches("", "OPCLabs.KitServer.2", "")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim BranchElement: For Each BranchElement In BranchElements
    WScript.Echo "BranchElements(""" & BranchElement.Name & """).HasChildren: " & BranchElement.HasChildren
Next
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012, Windows Server 2016; .NET Core, .NET 5, .NET 6: Linux, macOS, Microsoft Windows

See Also

Reference

IEasyDAClientExtension Class
IEasyDAClientExtension Members
Overload List