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



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace > IEasyUAClientExtension Class > Browse Method : Browse(IEasyUAClient,UAEndpointDescriptor,UANodeDescriptor,UABrowseParameters) 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).

UAEndpointDescriptor. 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).

UANodeDescriptor. 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).

UABrowseParameters. Specifies which nodes will be returned.

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

Browses the nodes in server's address space, given an endpoint descriptor, node descriptor, and browse parameters.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function Browse( _
   ByVal client As IEasyUAClient, _
   ByVal endpointDescriptor As UAEndpointDescriptor, _
   ByVal nodeDescriptor As UANodeDescriptor, _
   ByVal browseParameters As UABrowseParameters _
) As UANodeElementCollection
'Usage
 
Dim client As IEasyUAClient
Dim endpointDescriptor As UAEndpointDescriptor
Dim nodeDescriptor As UANodeDescriptor
Dim browseParameters As UABrowseParameters
Dim value As UANodeElementCollection
 
value = IEasyUAClientExtension.Browse(client, endpointDescriptor, nodeDescriptor, browseParameters)

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
UAEndpointDescriptor. 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
UANodeDescriptor. 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).

browseParameters
UABrowseParameters. Specifies which nodes will be returned.

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
// Shows how to obtain references of all kinds to nodes of all classes, from the "Server" node in the address space.
//
// 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 System.Diagnostics;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.AddressSpace;
using OpcLabs.EasyOpc.UA.AddressSpace.Standard;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    partial class Browse
    {
        public static void All()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

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

            // Obtain nodes under "Server" node
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.Browse(
                    endpointDescriptor,
                    UAObjectIds.Server,
                    new UABrowseParameters(UANodeClass.All, new[] { UAReferenceTypeIds.References }));
            }
            catch (UAException uaException)
            {
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException().Message);
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Debug.Assert(nodeElement != null);
                Console.WriteLine();
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName);
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId);
                Console.WriteLine("nodeElement.NodeId.ExpandedText: {0}", nodeElement.NodeId.ExpandedText);
            }
        }

        // Example output:
        //
        //nodeElement.DisplayName: ServerArray
        //nodeElement.NodeId: Server_ServerArray
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
        //
        //nodeElement.DisplayName: NamespaceArray
        //nodeElement.NodeId: Server_NamespaceArray
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
        //
        //nodeElement.DisplayName: ServerStatus
        //nodeElement.NodeId: Server_ServerStatus
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
        //
        //nodeElement.DisplayName: ServiceLevel
        //nodeElement.NodeId: Server_ServiceLevel
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
        //
        //nodeElement.DisplayName: Auditing
        //nodeElement.NodeId: Server_Auditing
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
        //
        //nodeElement.DisplayName: ServerCapabilities
        //nodeElement.NodeId: Server_ServerCapabilities
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2268
        //
        //nodeElement.DisplayName: ServerDiagnostics
        //nodeElement.NodeId: Server_ServerDiagnostics
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2274
        //
        //nodeElement.DisplayName: VendorServerInfo
        //nodeElement.NodeId: Server_VendorServerInfo
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2295
        //
        //nodeElement.DisplayName: ServerRedundancy
        //nodeElement.NodeId: Server_ServerRedundancy
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2296
        //
        //nodeElement.DisplayName: Namespaces
        //nodeElement.NodeId: Server_Namespaces
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11715
        //
        //nodeElement.DisplayName: GetMonitoredItems
        //nodeElement.NodeId: Server_GetMonitoredItems
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11492
        //
        //nodeElement.DisplayName: Data
        //nodeElement.NodeId: nsu=http://test.org/UA/Data/ ;ns=2;i=10157
        //nodeElement.NodeId.ExpandedText: nsu=http://test.org/UA/Data/ ;ns=2;i=10157
        //
        //nodeElement.DisplayName: Boilers
        //nodeElement.NodeId: nsu=http://opcfoundation.org/UA/Boiler/ ;ns=4;i=1240
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/Boiler/ ;ns=4;i=1240
        //
        //nodeElement.DisplayName: ServerType
        //nodeElement.NodeId: ServerType
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2004
    }
}
' Shows how to obtain references of all kinds to nodes of all classes, from the "Server" node in the address space.
'
' 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 _EasyUAClient
    Friend Class Browse
        Public Shared Sub All()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

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

            ' Obtain nodes under "Server" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.Browse(
                    endpointDescriptor,
                    UAObjectIds.Server,
                    New UABrowseParameters(UANodeClass.All, New UANodeId() {UAReferenceTypeIds.References}))
                ' or "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Debug.Assert(nodeElement IsNot Nothing)
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement
        End Sub
    End Class
End Namespace
# Shows how to obtain references of all kinds to nodes of all classes, from the "Server" node in the address space.
#
# 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 System.Collections.Generic import *
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.AddressSpace import *
from OpcLabs.EasyOpc.UA.AddressSpace.Standard import *
from OpcLabs.EasyOpc.UA.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

# Instantiate the client object.
client = EasyUAClient()

# Obtain nodes under "Server" node.
try:
    referenceTypeIdList = List[UANodeId]()
    referenceTypeIdList.Add(UAReferenceTypeIds.References)
    nodeElementCollection = IEasyUAClientExtension.Browse(client,
         endpointDescriptor,
         UANodeDescriptor(UAObjectIds.Server),
         UABrowseParameters(UANodeClass.All, referenceTypeIdList))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    assert nodeElement is not None
    print()
    print('nodeElement.DisplayName: ', nodeElement.DisplayName, sep='')
    print('nodeElement.NodeId: ', nodeElement.NodeId, sep='')
    print('nodeElement.NodeId.ExpandedText: ', nodeElement.NodeId.ExpandedText, sep='')

print()
print('Finished.')
// This example shows how to obtain nodes under a given node of the OPC-UA address space. 
// For each node, it displays its browse name and node ID.
//
// 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 System.Diagnostics;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.AddressSpace;
using OpcLabs.EasyOpc.UA.Navigation.Parsing;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    partial class Browse
    {
        public static void Main1()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            var browsePathParser = new UABrowsePathParser("http://test.org/UA/Data/");
            UANodeDescriptor nodeDescriptor = browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar");

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

            // perform the operation
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.Browse(
                    endpointDescriptor, 
                    nodeDescriptor, 
                    UABrowseParameters.AllForwardReferences);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Debug.Assert(!(nodeElement is null));
                Console.WriteLine($"{nodeElement.BrowseName}: {nodeElement.NodeId}");
            }
        }

        // Example output:
        //
        //BooleanValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10384
        //SByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10385
        //ByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10386
        //Int16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10387
        //UInt16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10388
        //Int32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10389
        //UInt32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10390
        //Int64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10391
        //UInt64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10392
        //FloatValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10393
        //DoubleValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10394
        //StringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10395
        //DateTimeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10396
        //GuidValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10397
        //ByteStringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10398
        //XmlElementValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10399
        //NodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10400
        //ExpandedNodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10401
        //QualifiedNameValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10402
        //LocalizedTextValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10403
        //StatusCodeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10404
        //VariantValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10405
        //SimulationActive: nsu=http://test.org/UA/Data/ ;ns=2;i=10328
        //GenerateValues: nsu=http://test.org/UA/Data/ ;ns=2;i=10329
        //CycleComplete: nsu=http://test.org/UA/Data/ ;ns=2;i=10331
        //UserScalarValueObjectType: nsu=http://test.org/UA/Data/ ;ns=2;i=9921
    }
}
# This example shows how to obtain nodes under a given node of the OPC-UA address space. 
# For each node, it displays its browse name and node ID.
#
# 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.Navigation.Parsing;
using namespace OpcLabs.EasyOpc.UA.OperationModel

# 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"

[UAEndpointDescriptor]$endpointDescriptor =
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
# or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
# or "https://opcua.demo-this.com:51212/UA/SampleServer/"

$browsePathParser = New-Object UABrowsePathParser("http://test.org/UA/Data/")
$nodeDescriptor = $browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar")

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

# perform the operation
try {
$nodeElementCollection = [IEasyUAClientExtension]::Browse($client,
    $endpointDescriptor, 
    $nodeDescriptor, 
    [UABrowseParameters]::AllForwardReferences)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

# Display results
foreach ($nodeElement in $nodeElementCollection) {
    Write-Host "$($nodeElement.BrowseName): $($nodeElement.NodeId)"
}


# Example output:
#
#BooleanValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10384
#SByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10385
#ByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10386
#Int16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10387
#UInt16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10388
#Int32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10389
#UInt32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10390
#Int64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10391
#UInt64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10392
#FloatValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10393
#DoubleValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10394
#StringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10395
#DateTimeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10396
#GuidValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10397
#ByteStringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10398
#XmlElementValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10399
#NodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10400
#ExpandedNodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10401
#QualifiedNameValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10402
#LocalizedTextValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10403
#StatusCodeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10404
#VariantValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10405
#SimulationActive: nsu=http://test.org/UA/Data/ ;ns=2;i=10328
#GenerateValues: nsu=http://test.org/UA/Data/ ;ns=2;i=10329
#CycleComplete: nsu=http://test.org/UA/Data/ ;ns=2;i=10331
#UserScalarValueObjectType: nsu=http://test.org/UA/Data/ ;ns=2;i=9921
' This example shows how to obtain nodes under a given node of the OPC-UA address space. 
' For each node, it displays its browse name and node ID.
'
' 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.Navigation.Parsing
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Partial Friend Class Browse
        Public Shared Sub Main1()
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            Dim browsePathParser As UABrowsePathParser = New UABrowsePathParser("http://test.org/UA/Data/")
            Dim nodeDescriptor As UANodeDescriptor = browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar")

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

            ' perform the operation
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.Browse(
                    endpointDescriptor,
                    nodeDescriptor,
                    UABrowseParameters.AllForwardReferences)
            Catch uaException As UAException
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}")
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Debug.Assert(nodeElement IsNot Nothing)
                Console.WriteLine($"{nodeElement.BrowseName}: {nodeElement.NodeId}")
            Next nodeElement
        End Sub

        ' Example output
        '
        'BooleanValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10384
        'SByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10385
        'ByteValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10386
        'Int16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10387
        'UInt16Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10388
        'Int32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10389
        'UInt32Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10390
        'Int64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10391
        'UInt64Value: nsu=http://test.org/UA/Data/ ;ns=2;i=10392
        'FloatValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10393
        'DoubleValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10394
        'StringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10395
        'DateTimeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10396
        'GuidValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10397
        'ByteStringValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10398
        'XmlElementValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10399
        'NodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10400
        'ExpandedNodeIdValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10401
        'QualifiedNameValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10402
        'LocalizedTextValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10403
        'StatusCodeValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10404
        'VariantValue: nsu=http://test.org/UA/Data/ ;ns=2;i=10405
        'SimulationActive: nsu=http://test.org/UA/Data/ ;ns=2;i=10328
        'GenerateValues: nsu=http://test.org/UA/Data/ ;ns=2;i=10329
        'CycleComplete: nsu=http://test.org/UA/Data/ ;ns=2;i=10331
        'UserScalarValueObjectType: nsu=http://test.org/UA/Data/ ;ns=2;i=9921
    End Class
End Namespace
# This example shows how to obtain nodes under a given node of the OPC-UA address space. 
# For each node, it displays its browse name and node ID.
#
# 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.Navigation.Parsing import *
from OpcLabs.EasyOpc.UA.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

browsePathParser = UABrowsePathParser('http://test.org/UA/Data/')
nodeDescriptor = UANodeDescriptor(browsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar'))

# Instantiate the client object.
client = EasyUAClient()

# Perform the operation.
try:
    nodeElements = IEasyUAClientExtension.Browse(client,
         endpointDescriptor,
         nodeDescriptor,
         UABrowseParameters.AllForwardReferences)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElements:
    assert nodeElement is not None
    print(nodeElement.BrowseName, ': ', nodeElement.NodeId, sep='')
Dim endpointDescriptor As UAEndpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
Dim nodeDescriptor As UANodeDescriptor = UAObjectIds.ObjectsFolder
Dim client As New EasyUAClient()
Dim nodeElementCollection As UANodeElementCollection = client.Browse(
    endpointDescriptor,
    nodeDescriptor,
    New UABrowseParameters(
        UANodeClass.Object Or UANodeClass.Variable,
        {UAReferenceTypeIds.HierarchicalReferences}))
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