OPC Studio User's Guide and Reference
BrowseEventSources(IEasyUAClient,UAEndpointDescriptor,UANodeDescriptor) Method
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace > IEasyUAClientExtension Class > BrowseEventSources Method : BrowseEventSources(IEasyUAClient,UAEndpointDescriptor,UANodeDescriptor) Method
The client object that will perform the operation.

This is typically the EasyUAClient object.

The value of this parameter cannot be null (Nothing in Visual Basic).

Endpoint descriptor. Identifies the OPC-UA server.

Because the UAEndpointDescriptor has implicit conversions from System.String and System.Uri, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a string (representing the endpoint URL, or a so-called OPC UA endpoint descriptor string), or a System.Uri object, in place of this parameter, and the corresponding endpoint descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the UAEndpointDescriptor.FromString or UAEndpointDescriptor.FromUri static method instead.

Also, because the OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement and OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement have an implicit conversion to UAEndpointDescriptor, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement (results from OPC UA discovery) in place of this parameter, and the corresponding endpoint descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can convert a (non-null) OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement to UAEndpointDescriptor using the OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement.ToUAEndpointDescriptor or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement.ToUAEndpointDescriptor method instead.

If you are using OPC Wizard (for server development), an implicit conversion from EasyUAServerCore can be used in the same way to simply pass the server object in place of this parameter, which will use its OpcLabs.EasyOpc.UA.EasyUAServerCore.EffectiveServerDescriptor property for the connection.

The value of this parameter cannot be null (Nothing in Visual Basic).

Node descriptor. Identifies the node in OPC server's address space.

Because the UANodeDescriptor has implicit conversions from OpcLabs.EasyOpc.UA.AddressSpace.UANodeId, OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement, OpcLabs.EasyOpc.UA.Navigation.UABrowsePath and System.String, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.AddressSpace.UANodeId object (representing the Id of the OPC UA node), a node element object (from OPC UA browsing), OpcLabs.EasyOpc.UA.Navigation.UABrowsePath object (representing OPC UA absolute browse path), or a string (with expanded node Id text) in place of this parameter, and the corresponding node descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the UANodeDescriptor.FromString, UANodeDescriptor.FromUABrowsePath, UANodeDescriptor.FromUANodeElement or UANodeDescriptor.FromUANodeId static method instead.

If you are using OPC Wizard (for server development), an implicit conversion from OpcLabs.EasyOpc.UA.NodeSpace.UAServerNode can be used in the same way to simply pass the server node in place of this parameter, which will use its OpcLabs.EasyOpc.UA.NodeSpace.UAServerNode.EffectiveNodeDescriptor property for the operation.

The value of this parameter cannot be null (Nothing in Visual Basic).

Browses the EventSources, specifying an endpoint descriptor, and a starting Node Id.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function BrowseEventSources( _
   ByVal client As IEasyUAClient, _
   ByVal endpointDescriptor As UAEndpointDescriptor, _
   ByVal nodeDescriptor As UANodeDescriptor _
) As UANodeElementCollection
'Usage
 
Dim client As IEasyUAClient
Dim endpointDescriptor As UAEndpointDescriptor
Dim nodeDescriptor As UANodeDescriptor
Dim value As UANodeElementCollection
 
value = IEasyUAClientExtension.BrowseEventSources(client, endpointDescriptor, nodeDescriptor)

Parameters

client
The client object that will perform the operation.

This is typically the EasyUAClient object.

The value of this parameter cannot be null (Nothing in Visual Basic).

endpointDescriptor
Endpoint descriptor. Identifies the OPC-UA server.

Because the UAEndpointDescriptor has implicit conversions from System.String and System.Uri, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a string (representing the endpoint URL, or a so-called OPC UA endpoint descriptor string), or a System.Uri object, in place of this parameter, and the corresponding endpoint descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the UAEndpointDescriptor.FromString or UAEndpointDescriptor.FromUri static method instead.

Also, because the OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement and OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement have an implicit conversion to UAEndpointDescriptor, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement (results from OPC UA discovery) in place of this parameter, and the corresponding endpoint descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can convert a (non-null) OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement to UAEndpointDescriptor using the OpcLabs.EasyOpc.UA.Discovery.UAApplicationElement.ToUAEndpointDescriptor or OpcLabs.EasyOpc.UA.Discovery.UADiscoveryElement.ToUAEndpointDescriptor method instead.

If you are using OPC Wizard (for server development), an implicit conversion from EasyUAServerCore can be used in the same way to simply pass the server object in place of this parameter, which will use its OpcLabs.EasyOpc.UA.EasyUAServerCore.EffectiveServerDescriptor property for the connection.

The value of this parameter cannot be null (Nothing in Visual Basic).

nodeDescriptor
Node descriptor. Identifies the node in OPC server's address space.

Because the UANodeDescriptor has implicit conversions from OpcLabs.EasyOpc.UA.AddressSpace.UANodeId, OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement, OpcLabs.EasyOpc.UA.Navigation.UABrowsePath and System.String, in languages that support implicit conversion operators (such as C# or VB.NET), you can simply use a OpcLabs.EasyOpc.UA.AddressSpace.UANodeId object (representing the Id of the OPC UA node), a node element object (from OPC UA browsing), OpcLabs.EasyOpc.UA.Navigation.UABrowsePath object (representing OPC UA absolute browse path), or a string (with expanded node Id text) in place of this parameter, and the corresponding node descriptor will be constructed automatically. When the implicit conversion operators are not supported (such as with Python.NET), you can use the UANodeDescriptor.FromString, UANodeDescriptor.FromUABrowsePath, UANodeDescriptor.FromUANodeElement or UANodeDescriptor.FromUANodeId static method instead.

If you are using OPC Wizard (for server development), an implicit conversion from OpcLabs.EasyOpc.UA.NodeSpace.UAServerNode can be used in the same way to simply pass the server node in place of this parameter, which will use its OpcLabs.EasyOpc.UA.NodeSpace.UAServerNode.EffectiveNodeDescriptor property for the operation.

The value of this parameter cannot be null (Nothing in Visual Basic).

Return Value

The method returns a node element collection, which contains OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement values. Each element contains information about a particular node found.

This method never returns null (Nothing in Visual Basic).

The individual elements of the returned value are never null (Nothing in Visual Basic).

Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

The OPC UA operation has failed. This operation exception in uniformly used to allow common handling of various kinds of errors. The System.Exception.InnerException always contains information about the actual error cause.

This is an operation error that depends on factors external to your program, and thus cannot be always avoided. Your code must handle it appropriately.

Remarks

This is an extension method (info: C#, VB.NET). In languages that have support for extensions methods (such as C# and VB.NET), you can use the extension method as if it were a regular method on the object that is its first parameter. In other languages (such as with Python.NET), you will call the extension as a static method, and pass it the object on which it acts as its first parameter.

Example
// This example shows how to browse objects under the "Objects" node and display event sources.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.AddressSpace;
using OpcLabs.EasyOpc.UA.AddressSpace.Standard;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples.AlarmsAndConditions
{
    class BrowseEventSources
    {
        public static void Overload2()
        {
            // Start browsing from the "Objects" node.
            try
            {
                BrowseFrom(UAObjectIds.ObjectsFolder);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
            }

            Console.WriteLine();
            Console.WriteLine("Finished.");
        }

        private static void BrowseFrom(UANodeDescriptor nodeDescriptor)
        {
            // Define which server we will work with.
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer";

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine($"Parent node: {nodeDescriptor}");

            // Instantiate the client object.
            var client = new EasyUAClient();

            // Obtain event sources.
            UANodeElementCollection eventSourceNodeElementCollection = client.BrowseEventSources(
                endpointDescriptor, nodeDescriptor);

            // Display event sources.
            if (eventSourceNodeElementCollection.Count != 0)
            {
                Console.WriteLine();
                Console.WriteLine("Event sources:");
                foreach (UANodeElement eventSourceNodeElement in eventSourceNodeElementCollection)
                    Console.WriteLine(eventSourceNodeElement);
            }

            // Obtain objects.
            UANodeElementCollection objectNodeElementCollection = client.BrowseObjects(
                endpointDescriptor, nodeDescriptor);

            // Recurse.
            foreach (UANodeElement objectNodeElement in objectNodeElementCollection)
                BrowseFrom(objectNodeElement);
        }


        // Example output (truncated):
        //
        //
        //Parent node: ObjectsFolder
        //
        //
        //Parent node: Server
        //
        //Event sources:
        //Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
        //Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
        //
        //
        //Parent node: Server_ServerCapabilities
        //...
    }
}
# This example shows how to browse objects under the "Objects" node and display event sources.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in PowerShell on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PowerShell .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard
using namespace OpcLabs.EasyOpc.UA.Navigation.Parsing;
using namespace OpcLabs.EasyOpc.UA.OperationModel


function BrowseEventSourcesFrom([UANodeDescriptor]$nodeDescriptor) { 

    # Define which server we will work with.
    [UAEndpointDescriptor]$endpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer"

    Write-Host
    Write-Host
    Write-Host "Parent node: $($nodeDescriptor)"

    # Instantiate the client object.
    $client = New-Object EasyUAClient

    # Obtain event sources.
    $eventSourceNodeElementCollection = [IEasyUAClientExtension]::BrowseEventSources($client,
        $endpointDescriptor, $nodeDescriptor)

    # Display event sources.
    if ($eventSourceNodeElementCollection.Count -ne 0) {
        Write-Host
        Write-Host "Event sources:"
        foreach ($eventSourceNodeElement in $eventSourceNodeElementCollection) {
            Write-Host $eventSourceNodeElement
        }
    }

    # Obtain objects.
    $objectNodeElementCollection = [IEasyUAClientExtension]::BrowseObjects($client,
        $endpointDescriptor, $nodeDescriptor)

    # Recurse.
    foreach ($objectNodeElement in $objectNodeElementCollection) {
        BrowseEventSourcesFrom($objectNodeElement)
    }
}


# The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows .
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUA.dll"
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUAComponents.dll"

# Start browsing from the "Objects" node.
try {
    [UANodeDescriptor]$startingNodeDescriptor = [UAObjectIds]::ObjectsFolder
    BrowseEventSourcesFrom $startingNodeDescriptor
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

Write-Host
Write-Host "Finished."


# Example output (truncated):
#
#
#Parent node: ObjectsFolder
#
#
#Parent node: Server
#
#Event sources:
#Green -> nsu=http:#opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
#Yellow -> nsu=http:#opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
#
#
#Parent node: Server_ServerCapabilities
#...
' This example shows how to browse objects under the "Objects" node and display event sources.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.AddressSpace
Imports OpcLabs.EasyOpc.UA.AddressSpace.Standard
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace AlarmsAndConditions
    Friend Class BrowseEventSources
        Public Shared Sub Overload2()

            ' Start browsing from the "Objects" node
            Try
                BrowseFrom(UAObjectIds.ObjectsFolder)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
            End Try
        End Sub

        Private Shared Sub BrowseFrom(nodeDescriptor As UANodeDescriptor)

            Console.WriteLine()
            Console.WriteLine()
            Console.WriteLine("Parent node: {0}", nodeDescriptor)

            ' Instantiate the client object
            Dim client = New EasyUAClient()

            ' Obtain notifiers
            Dim eventSourceNodeElementCollection As UANodeElementCollection = client.BrowseEventSources( _
                "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer", _
                nodeDescriptor)

            ' Display notifiers
            Console.WriteLine()
            Console.WriteLine("Event sources:")
            For Each eventSourceNodeElement As UANodeElement In eventSourceNodeElementCollection
                Console.WriteLine(eventSourceNodeElement)
            Next eventSourceNodeElement

            ' Obtain objects
            Dim objectNodeElementCollection = client.BrowseObjects( _
                "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer", _
                nodeDescriptor)

            ' Recurse
            For Each objectNodeElement As UANodeElement In objectNodeElementCollection
                BrowseFrom(objectNodeElement)
            Next objectNodeElement
        End Sub
    End Class
End Namespace
// This example shows how to browse objects under the "Objects" node and display event sources.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

class procedure BrowseEventSources.Main;
var
  ObjectNodeId: _UANodeId;
begin
  ObjectNodeId := CoUANodeId.Create;
  ObjectNodeId.StandardName := 'Objects';
  try
    BrowseFrom(ObjectNodeId);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;
end;

class procedure BrowseEventSources.BrowseFrom(NodeId: _UANodeId);
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  EventSourceNodeElement: _UANodeElement;
  EventSourceNodeElementEnumerator: IEnumVariant;
  EventSourceNodeElements: _UANodeElementCollection;
  ObjectNodeElement: _UANodeElement;
  ObjectNodeElementEnumerator: IEnumVariant;
  ObjectNodeElements: _UANodeElementCollection;
begin
  EndpointDescriptor := 'opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer';

  WriteLn;
  WriteLn;
  WriteLn('Parent node: ', NodeId.ToString);

  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  // Obtain event sources
  EventSourceNodeElements := Client.BrowseEventSources(EndpointDescriptor, NodeId.ExpandedText);

  // Display event sources
  if EventSourceNodeElements.Count <> 0 then
  begin
    WriteLn;
    WriteLn('Event sources:');
    EventSourceNodeElementEnumerator := EventSourceNodeElements.GetEnumerator;
    while (EventSourceNodeElementEnumerator.Next(1, Element, Count) = S_OK) do
    begin
      EventSourceNodeElement := IUnknown(Element) as _UANodeElement;
      WriteLn(EventSourceNodeElement.ToString);
    end;
  end;

  // Obtain objects
  ObjectNodeElements := Client.BrowseObjects(EndpointDescriptor, NodeId.ExpandedText);

  // Recurse
  ObjectNodeElementEnumerator := ObjectNodeElements.GetEnumerator;
  while (ObjectNodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    ObjectNodeElement := IUnknown(Element) as _UANodeElement;
    BrowseFrom(ObjectNodeElement.NodeId);
  end;
end;
// This example shows how to browse objects under the "Objects" node and display event sources.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in PHP on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PHP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.


// Start browsing from the "Objects" node
$ObjectNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ObjectNodeId->StandardName = "Objects";
try
{
    BrowseFrom($ObjectNodeId);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

function BrowseFrom($NodeId) {
    $EndpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer";

    printf("\n");
    printf("\n");
    printf("Parent node: %s\n", $NodeId);

    // Instantiate the client object
    $Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");

    // Obtain event sources
    $EventSourceNodeElements = $Client->BrowseEventSources($EndpointDescriptor, $NodeId->ExpandedText);

    // Display event sources
    if ($EventSourceNodeElements->Count != 0) {
        printf("\n");
        printf("Event sources:\n");
        foreach ($EventSourceNodeElements as $EventSourceNodeElement)
        {
             printf("%s\n", $EventSourceNodeElement);
        }
     }

    // Obtain objects
    $ObjectNodeElements = $Client->BrowseObjects($EndpointDescriptor, $NodeId->ExpandedText);

    // Recurse
    foreach ($ObjectNodeElements as $ObjectNodeElement)
    {
         BrowseFrom($ObjectNodeElement->NodeId);
    }
}

// Example output (truncated):
//
//
//Parent node: ObjectsFolder
//
//
//Parent node: Server
//
//Event sources:
//Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
//Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
//
//
//Parent node: Server_ServerCapabilities
//...
Rem This example shows how to browse objects under the "Objects" node and display event sources.
Rem
Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
Rem a commercial license in order to use Online Forums, and we reply to every post.

Option Explicit

' Start browsing from the "Objects" node
Dim ObjectsNodeId: Set ObjectsNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ObjectsNodeId.StandardName = "Objects"
On Error Resume Next
BrowseFrom ObjectsNodeId
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0



Sub BrowseFrom(NodeId)
    Dim endpointDescriptor
    endpointDescriptor = "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer"

    WScript.Echo 
    WScript.Echo 
    WScript.Echo "Parent node: " & NodeId

    ' Instantiate the client object
    Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")

    ' Obtain event sources
    Dim EventSourceNodeElementCollection: Set EventSourceNodeElementCollection = Client.BrowseEventSources( _
        endpointDescriptor, NodeId.ExpandedText)

    ' Display event sources
    If EventSourceNodeElementCollection.Count <> 0 Then
        WScript.Echo 
        WScript.Echo "Event sources:"
        Dim EventSourceNodeElement: For Each EventSourceNodeElement In EventSourceNodeElementCollection
            WScript.Echo EventSourceNodeElement
        Next
    End If
    
    ' Obtain objects
    Dim ObjectNodeElementCollection: Set ObjectNodeElementCollection = Client.BrowseObjects( _
        endpointDescriptor, NodeId.ExpandedText)

    ' Recurse
    Dim ObjectNodeElement: For Each ObjectNodeElement In ObjectNodeElementCollection
        BrowseFrom ObjectNodeElement.NodeId
    Next
End Sub



' Example output (truncated):
'
'
'Parent node: ObjectsFolder
'
'
'Parent node: Server
'
'Event sources:
'Green -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Green (Object)
'Yellow -> nsu=http://opcfoundation.org/Quickstarts/AlarmCondition ;ns=2;s=0:/Yellow (Object)
'
'
'Parent node: Server_ServerCapabilities
'...
# This example shows how to browse objects under the "Objects" node and display event sources.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.AddressSpace import *
from OpcLabs.EasyOpc.UA.AddressSpace.Standard import *
from OpcLabs.EasyOpc.UA.OperationModel import *


# Define which server we will work with.
endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer')


def browseFrom(nodeDescriptor):
    global endpointDescriptor

    print()
    print()
    print('Parent node: ', nodeDescriptor, sep='')

    # Instantiate the client object.
    client = EasyUAClient()

    # Obtain event sources.
    eventSourceNodeElementCollection = IEasyUAClientExtension.BrowseEventSources(client,
                                                                                 endpointDescriptor,
                                                                                 nodeDescriptor)

    # Display event sources.
    if eventSourceNodeElementCollection.Count != 0:
        print('')
        print('Event sources:')
        for eventSourceNodeElement in eventSourceNodeElementCollection:
            print(eventSourceNodeElement)

    # Obtain objects.
    objectNodeElementCollection = IEasyUAClientExtension.BrowseObjects(client,
                                                                       endpointDescriptor,
                                                                       nodeDescriptor)

    # Recurse.
    for objectNodeElement in objectNodeElementCollection:
        browseFrom(objectNodeElement.ToUANodeDescriptor())


# Start browsing from the "Objects" node.
try:
    browseFrom(UANodeDescriptor(UAObjectIds.ObjectsFolder))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

print()
print('Finished.')
Requirements

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

See Also