OPC Studio User's Guide and Reference
UANodeElement Class
Members  Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.AddressSpace Namespace : UANodeElement Class
Contains information gathered about a node in OPC server's address space.
Object Model
UANodeElement ClassUAQualifiedName ClassUABrowsePath ClassUANodeId ClassUANodeId ClassUANodeId Class
Syntax
'Declaration
 
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement)>
<ComVisibleAttribute(True)>
<DefaultPropertyAttribute("BrowseName")>
<GuidAttribute("EF28FB7A-CF19-4288-ACC3-5A87085D7ECC")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<CLSCompliantAttribute(True)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public Class UANodeElement 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement, IUANodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As UANodeElement
[ComDefaultInterface(OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement)]
[ComVisible(true)]
[DefaultProperty("BrowseName")]
[Guid("EF28FB7A-CF19-4288-ACC3-5A87085D7ECC")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public class UANodeElement : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement, IUANodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[ComDefaultInterface(OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement)]
[ComVisible(true)]
[DefaultProperty("BrowseName")]
[Guid("EF28FB7A-CF19-4288-ACC3-5A87085D7ECC")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.80.82.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class UANodeElement : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.AddressSpace.ComTypes._UANodeElement, IUANodeElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks
This object is filled in and returned e.g. when you browse the OPC server's address space.

 

Principles

In OPC Unified Architecture, the address space is composed of nodes. The nodes are interconnected by means of references. The references do not necessarily have to be hierarchical; this means that the address space does not form a tree, but it is generally an interconnected “mesh” of nodes.

Nodes are of different node classes, and each node class has a fixed set of attributes, defined in the OPC specification. References can also be of various types, and the set of reference types is extensible.

OPC Data Client gives you methods to traverse through the address space information and obtain the information available there. It is also possible to filter the returned nodes by criteria such as the node classes of interest, or reference types to follow.

The address space may contain all kinds of information and various node classes and types of references. In this chapter, we will focus on browsing for node classes and reference types that are relevant for data access tasks.

There are following browse methods specialized for data access:

Other browsing methods are:

Objects (returned by the BrowseObjects method) are equivalent of folders in a file system – they provide means of organizing other nodes logically. Data variables (returned by the BrowseDataVariables method) represent a value, and clients can read the value, write the value, or subscribe to changes of the value. Properties (returned by the BrowseProperties method) represent additional characteristics of a node which is not described by its attributes. Variables (either data variables, or properties), are returned by the BrowseVariables method. The BrowseDataNodes method returns all kinds of data nodes – and we use the term data nodes for any of objects, variables, or properties.

The following picture shows the relationship between various browsing options.

If you want to retrieve a list of all nodes that can be followed from a given node (or from an Objects folder that is a default starting point for data access browsing) of the OPC server, call one of the methods listed above. You will receive back a UANodeElementCollection, which is a collection of UANodeElement objects. Each UANodeElement contains information gathered about one node that can be followed from a given node, such as its browse name, its node ID, its display name, or a type definition. The UANodeElement is convertible to UANodeDescriptor, and you can therefore pass it to methods for further browsing from that node, or to methods like Read, ReadValueSubscribeMonitoredItem, or SubscribeDataChange.

Note: In some cases, defined by the OPC UA specification, the elements returned in the UANodeElementCollection will have unique browse names. In general, however, OPC UA allows multiple returned elements share the same browse name.

The OPC UA address space may also contain Methods. They can be used to call (invoke) a code in the OPC UA server, passing input and output arguments to/from the method. Methods available on a specified object are returned by the BrowseMethods call.

The most generic address space browsing method is the Browse Method. It allows the widest range of filtering options by passing in an argument of type UABrowseParameters.  You can specify any set of node classes, and reference type IDs, with this object.

Using the ReferenceTypeIds property in the UABrowseParameters, you can specify which references in the address space will be followed in browsing. The IncludeSubtypes flag determines whether subtypes of the specified reference type should be returned by the browsing.

Using the BrowseDirections property in the UABrowseParameters, you can specify which directions of the references the Browse method should return. The available choices are given by the UABrowseDirections enumeration, and are Forward, Inverse, and Both.

Examples

.NET

// This example shows how to obtain "data nodes" (objects, variables and properties) under the "Objects" node in the address
// space.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples._EasyUAClient
{
    partial class BrowseDataNodes
    {
        public static void Overload1()
        {
            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 data nodes under "Objects" node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseDataNodes(endpointDescriptor);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Console.WriteLine();
                Console.WriteLine($"nodeElement.DisplayName: {nodeElement.DisplayName}");
                Console.WriteLine($"nodeElement.NodeId: {nodeElement.NodeId}");
                Console.WriteLine($"nodeElement.NodeId.ExpandedText: {nodeElement.NodeId.ExpandedText}");
            }
        }

        // Example output:
        //
        //nodeElement.DisplayName: Server
        //nodeElement.NodeId: Server
        //nodeElement.NodeId.ExpandedText: nsu = http://opcfoundation.org/UA/ ;i=2253
        //
        //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: MemoryBuffers
        //nodeElement.NodeId: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
        //nodeElement.NodeId.ExpandedText: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
    }
}
# This example shows how to obtain "data nodes" (objects, variables and properties) under the "Objects" node in the address
# space.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
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/"

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

# Obtain data nodes under "Objects" node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseDataNodes($client, $endpointDescriptor)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

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


# Example output:
#
#nodeElement.DisplayName: Server
#nodeElement.NodeId: Server
#nodeElement.NodeId.ExpandedText: nsu = http://opcfoundation.org/UA/ ;i=2253
#
#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: MemoryBuffers
#nodeElement.NodeId: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
#nodeElement.NodeId.ExpandedText: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025

# This example shows how to obtain all data nodes (objects and variables) 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 .
# 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.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 data nodes under "Objects" node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseDataNodes(client, endpointDescriptor)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    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 "data nodes" (objects, variables and properties) under the "Objects" node in the address
' space.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Friend Class BrowseDataNodes
        Public Shared Sub Overload1()

            ' 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 data nodes under "Objects" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseDataNodes(endpointDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement

            ' Example output:
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2253
            'nodeElement.DisplayName: Server
            '
            'nodeElement.NodeId: nsu=http://test.org/UA/Data/ ;i=10157
            'nodeElement.DisplayName: Data
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/Boiler/;i=1240
            'nodeElement.DisplayName: Boilers
            '
            'nodeElement.NodeId: nsu=http://samples.org/UA/memorybuffer;i=1025
            'nodeElement.DisplayName: MemoryBuffers            
        End Sub
    End Class
End Namespace

COM

// This example shows how to obtain all data nodes (objects and variables) 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 .

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "BrowseDataNodes.h"

namespace _EasyUAClient
{
    void BrowseDataNodes::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            // Instantiate the client object
            _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));

            // Perform the operation
            _UANodeElementCollectionPtr NodeElementsPtr = ClientPtr->BrowseDataNodes(
                //L"http://opcua.demo-this.com:51211/UA/SampleServer", 
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer",
                L"nsu=http://test.org/UA/Data/ ;i=10791");
    
            // Display results
            IEnumVARIANTPtr EnumNodeElementPtr = NodeElementsPtr->GetEnumerator();
            _variant_t vNodeElement;
            while (EnumNodeElementPtr->Next(1, &vNodeElement, NULL) == S_OK)
            {
                _UANodeElementPtr NodeElementPtr(vNodeElement);
                _tprintf(_T("%s: "), (LPCTSTR)CW2CT(NodeElementPtr->BrowseName->ToString));
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(NodeElementPtr->NodeId->ToString));
                vNodeElement.Clear();
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
// This example shows how to obtain all data nodes (objects and variables)
// 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 .

class procedure BrowseDataNodes.Main;
var
  Client: EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  NodeElements := Client.BrowseDataNodes(
    //'http://opcua.demo-this.com:51211/UA/SampleServer',
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
    'nsu=http://test.org/UA/Data/ ;i=10791');

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// This example shows how to obtain all data nodes (objects and variables)
// 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 .

class procedure BrowseDataNodes.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  try
    NodeElements := Client.BrowseDataNodes(
      //'http://opcua.demo-this.com:51211/UA/SampleServer',
      //'https://opcua.demo-this.com:51212/UA/SampleServer/',
      'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
      'nsu=http://test.org/UA/Data/ ;i=10791');
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// This example shows how to obtain all data nodes (objects and variables) 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 .

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

// Perform the operation
try
{
    $NodeElements = $Client->BrowseDataNodes(
        //"http://opcua.demo-this.com:51211/UA/SampleServer", 
        "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", 
        "nsu=http://test.org/UA/Data/ ;i=10791");
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    Exit();
}

// Display results
foreach ($NodeElements as $NodeElement)
{
    printf(" s\n", $NodeElement->BrowseName, $NodeElement->NodeId);
}
// This example shows how to obtain all data nodes (objects and variables) under a given node of the OPC-UA address space.
// For each node, it displays its browse name and node ID.

mle_outputtext.Text = ""

// Instantiate the client object
OLEObject client
client = CREATE OLEObject
client.ConnectToNewObject("OpcLabs.EasyOpc.UA.EasyUAClient")

// Perform the operation
OLEObject nodeElements
TRY
    nodeElements = client.BrowseDataNodes("http://opcua.demo-this.com:51211/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10791")
CATCH (OLERuntimeError oleRuntimeError)
    mle_outputtext.Text = mle_outputtext.Text + "*** Failure: " + oleRuntimeError.Description + "~r~n"
    RETURN
END TRY

// Display results
Int i
FOR i = 0 TO nodeElements.Count - 1
    OLEObject nodeElement
    nodeElement = nodeElements.Item[i]
    mle_outputtext.Text = mle_outputtext.Text + "~r~n"
    mle_outputtext.Text = mle_outputtext.Text + "nodeElement.NodeId: " + nodeElement.NodeId.DisplayString + "~r~n"
    mle_outputtext.Text = mle_outputtext.Text + "nodeElement.DisplayName: " + nodeElement.DisplayName + "~r~n"
NEXT

mle_outputtext.Text = mle_outputtext.Text + "~r~n" 
mle_outputtext.Text = mle_outputtext.Text + "Finished." + "~r~n" 
# This example shows how to obtain all data nodes (objects and variables) under a given node of the OPC-UA address space. 
# For each node, it displays its browse name and node ID.
#
# The Python for Windows (pywin32) extensions package is needed. Install it using "pip install pypiwin32".
# CAUTION: We now recommend using Python.NET package instead. Full set of examples with Python.NET is available!
#
# Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
import win32com.client
from pywintypes import com_error

# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient') 

# Perform the operation
try:
    nodeElements = client.BrowseDataNodes('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer', 'nsu=http://test.org/UA/Data/ ;i=10791')
except com_error as e:
    print('*** Failure: ' + e.args[2][1] + ': ' + e.args[2][2])
    exit()

# Display results
for nodeElement in nodeElements:
    print(nodeElement.BrowseName, ': ', nodeElement.NodeId)
REM This example shows how to obtain all data nodes (objects and variables) under a given node of the OPC-UA address space.
REM For each node, it displays its browse name and node ID.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseDataNodes_Main_Command_Click()
    OutputText = ""

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Perform the operation
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseDataNodes("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10791")
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & NodeElement.BrowseName & ": " & NodeElement.NodeId & vbCrLf
    Next
End Sub
Rem This example shows how to obtain all data nodes (objects and variables) under a given node of the OPC-UA address space. 
Rem For each node, it displays its browse name and node ID.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

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

' Perform the operation
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.BrowseDataNodes("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10791")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo NodeElement.BrowseName & ": " & NodeElement.NodeId
Next

 

.NET

// 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 .

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 .

#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 Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# 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='')
' 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 .

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

COM

// 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 .

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "Browse.h"

namespace _EasyUAClient
{
    void Browse::Main()
    {
        // Initialize the COM library
        CoInitializeEx(nullptr, COINIT_MULTITHREADED);
        {
            _UAEndpointDescriptorPtr EndpointDescriptorPtr(__uuidof(UAEndpointDescriptor));
            EndpointDescriptorPtr->UrlString = 
                //L"http://opcua.demo-this.com:51211/UA/SampleServer";
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";

            _UANodeDescriptorPtr NodeDescriptorPtr(__uuidof(UANodeDescriptor));
            _UABrowsePathParserPtr BrowsePathParserPtr(__uuidof(UABrowsePathParser));
            BrowsePathParserPtr->DefaultNamespaceUriString = L"http://test.org/UA/Data/";
            NodeDescriptorPtr->BrowsePath = BrowsePathParserPtr->Parse(L"[ObjectsFolder]/Data/Static/UserScalar");

            _UABrowseParametersPtr BrowseParametersPtr(__uuidof(UABrowseParameters));
            BrowseParametersPtr->StandardName = L"AllForwardReferences";

            // Instantiate the client object
            _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));

            // Perform the operation
            _UANodeElementCollectionPtr NodeElementsPtr = ClientPtr->Browse(
                static_cast<IDispatch*>(EndpointDescriptorPtr), 
                static_cast<IDispatch*>(NodeDescriptorPtr), 
                static_cast<IDispatch*>(BrowseParametersPtr));
    
            // Display results
            IEnumVARIANTPtr EnumNodeElementPtr = NodeElementsPtr->GetEnumerator();
            _variant_t vNodeElement;
            while (EnumNodeElementPtr->Next(1, &vNodeElement, nullptr) == S_OK)
            {
                const _UANodeElementPtr NodeElementPtr(vNodeElement);
                _tprintf(_T("%s: "), (LPCTSTR)CW2CT(NodeElementPtr->BrowseName->ToString));
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(NodeElementPtr->NodeId->ToString));
                vNodeElement.Clear();
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
// 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 .

class procedure Browse.Main;
var
  BrowseParameters: _UABrowseParameters;
  BrowsePathParser: _UABrowsePathParser;
  Client: EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: _UAEndpointDescriptor;
  NodeDescriptor: _UANodeDescriptor;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  EndpointDescriptor := CoUAEndpointDescriptor.Create;
  EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';

  NodeDescriptor := CoUANodeDescriptor.Create;
  BrowsePathParser := CoUABrowsePathParser.Create;
  BrowsePathParser.DefaultNamespaceUriString := 'http://test.org/UA/Data/';
  NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar');

  BrowseParameters := CoUABrowseParameters.Create;
  BrowseParameters.StandardName := 'AllForwardReferences';

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

  NodeElements := Client.Browse(
    EndpointDescriptor,
    NodeDescriptor,
    BrowseParameters);

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// 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 .

class procedure Browse.Main;
var
  BrowseParameters: _UABrowseParameters;
  BrowsePathParser: _UABrowsePathParser;
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: _UAEndpointDescriptor;
  NodeDescriptor: _UANodeDescriptor;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  EndpointDescriptor := CoUAEndpointDescriptor.Create;
  EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';

  NodeDescriptor := CoUANodeDescriptor.Create;
  BrowsePathParser := CoUABrowsePathParser.Create;
  BrowsePathParser.DefaultNamespaceUriString := 'http://test.org/UA/Data/';
  NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar');

  BrowseParameters := CoUABrowseParameters.Create;
  BrowseParameters.StandardName := 'AllForwardReferences';

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

  try
    NodeElements := Client.Browse(
      EndpointDescriptor,
      NodeDescriptor,
      BrowseParameters);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// 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 .

$EndpointDescriptor = new COM("OpcLabs.EasyOpc.UA.UAEndpointDescriptor");
$EndpointDescriptor->UrlString = 
    //"http://opcua.demo-this.com:51211/UA/SampleServer";
    //"https://opcua.demo-this.com:51212/UA/SampleServer/";
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";

$NodeDescriptor = new COM("OpcLabs.EasyOpc.UA.UANodeDescriptor");
$BrowsePathParser = new COM("OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser");
$BrowsePathParser->DefaultNamespaceUriString = "http://test.org/UA/Data/";
$NodeDescriptor->BrowsePath = $BrowsePathParser->Parse("[ObjectsFolder]/Data/Static/UserScalar");

$BrowseParameters = new COM("OpcLabs.EasyOpc.UA.UABrowseParameters");
$BrowseParameters->StandardName = "AllForwardReferences";

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

// Perform the operation
try
{
    $NodeElements = $Client->Browse($EndpointDescriptor, $NodeDescriptor, $BrowseParameters);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

// Display results
foreach ($NodeElements as $NodeElement)
{
    printf(" s\n", $NodeElement->BrowseName, $NodeElement->NodeId);
}
# 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.
#
# The Python for Windows (pywin32) extensions package is needed. Install it using "pip install pypiwin32".
# CAUTION: We now recommend using Python.NET package instead. Full set of examples with Python.NET is available!
#
# Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
import win32com.client
from pywintypes import com_error

endpointDescriptor = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.UAEndpointDescriptor')
#endpointDescriptor.UrlString = 'http://opcua.demo-this.com:51211/UA/SampleServer'
endpointDescriptor.UrlString = 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'

nodeDescriptor = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.UANodeDescriptor')
browsePathParser = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser')
browsePathParser.DefaultNamespaceUriString = 'http://test.org/UA/Data/'
nodeDescriptor.BrowsePath = browsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar')

browseParameters = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.UABrowseParameters')
browseParameters.StandardName = 'AllForwardReferences'

# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.UA.EasyUAClient') 

# Perform the operation
try:
    nodeElements = client.Browse(endpointDescriptor, nodeDescriptor, browseParameters)
except com_error as e:
    print('*** Failure: ' + e.args[2][1] + ': ' + e.args[2][2])
    exit()

# Display results
for nodeElement in nodeElements:
    print(nodeElement.BrowseName, ': ', nodeElement.NodeId)
REM This example shows how to obtain nodes under a given node of the OPC-UA address space.
REM For each node, it displays its browse name and node ID.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub Browse_Main_Command_Click()
    OutputText = ""

    Dim endpointDescriptor As New UAEndpointDescriptor
    endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

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

    Dim browseParameters As New UABrowseParameters
    browseParameters.StandardName = "AllForwardReferences"

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Perform the operation
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.Browse(endpointDescriptor, nodeDescriptor, browseParameters)
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0
    
    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & NodeElement.BrowseName & ": " & NodeElement.NodeId & vbCrLf
    Next
End Sub
Rem This example shows how to obtain nodes under a given node of the OPC-UA address space. 
Rem For each node, it displays its browse name and node ID.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim EndpointDescriptor: Set EndpointDescriptor = CreateObject("OpcLabs.EasyOpc.UA.UAEndpointDescriptor")
EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.UA.UANodeDescriptor")
Dim BrowsePathParser: Set BrowsePathParser = CreateObject("OpcLabs.EasyOpc.UA.Navigation.Parsing.UABrowsePathParser")
BrowsePathParser.DefaultNamespaceUriString = "http://test.org/UA/Data/"
NodeDescriptor.BrowsePath = BrowsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar")

Dim BrowseParameters: Set BrowseParameters = CreateObject("OpcLabs.EasyOpc.UA.UABrowseParameters")
BrowseParameters.StandardName = "AllForwardReferences"

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

' Perform the operation
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.Browse(EndpointDescriptor, NodeDescriptor, BrowseParameters)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo NodeElement.BrowseName & ": " & NodeElement.NodeId
Next

// 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 .

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 Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# 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.')
' 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 .

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

.NET

// This example shows how to obtain data variables under the "Server" node in the address space.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples._EasyUAClient
{
    class BrowseDataVariables
    {
        public static void Overload2()
        {
            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 data variables under "Server" node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseDataVariables(endpointDescriptor, UAObjectIds.Server);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Console.WriteLine();
                Console.WriteLine($"nodeElement.DisplayName: {nodeElement.DisplayName}");
                Console.WriteLine($"nodeElement.NodeId: {nodeElement.NodeId}");
                Console.WriteLine($"nodeElement.NodeId.ExpandedText: {nodeElement.NodeId.ExpandedText}");
            }
        }

        // Example output:
        //
        //nodeElement.DisplayName: ServerStatus            
        //nodeElement.NodeId: Server_ServerStatus
        //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
    }
}
# This example shows how to obtain data variables under the "Server" node in the address space.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard
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/"

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

# Obtain data variables under "Server" node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseDataVariables($client, 
        $endpointDescriptor, [UAObjectIds]::Server)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

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


# Example output:
#
#nodeElement.DisplayName: ServerStatus            
#nodeElement.NodeId: Server_ServerStatus
#nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256

# This example shows how to obtain data variables under 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 .
# 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 *


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 data variables under "Server" node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseDataVariables(client,
                                                                       endpointDescriptor,
                                                                       UANodeDescriptor(UAObjectIds.Server))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    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 data variables under the "Server" node in the address space.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Friend Class BrowseDataVariables
        Public Shared Sub Overload2()

            ' 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 variables under "Server" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseDataVariables(endpointDescriptor, UAObjectIds.Server)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement

            ' Example output:
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2256
            'nodeElement.DisplayName: ServerStatus            
        End Sub
    End Class
End Namespace

COM

// This example shows how to obtain data variables under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseDataVariables.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
  ServerNodeId: _UANodeId;
begin
  EndpointDescriptor := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';

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

  // Obtain variables under "Server" node
  ServerNodeId := CoUANodeId.Create;
  ServerNodeId.StandardName := 'Server';
  try
    NodeElements := Client.BrowseDataVariables(EndpointDescriptor, ServerNodeId.ExpandedText);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  // Display results
  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn;
    WriteLn('nodeElement.NodeId: ', NodeElement.NodeId.ToString);
    WriteLn('nodeElement.NodeId.ExpandedText: ', NodeElement.NodeId.ExpandedText);
    WriteLn('nodeElement.DisplayName: ', NodeElement.DisplayName);
  end;

  // Example output:
  //
  //nodeElement.NodeId: Server_ServerStatus
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
  //nodeElement.DisplayName: ServerStatus
end;
// This example shows how to obtain data variables under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

$EndpointDescriptor = new COM("OpcLabs.EasyOpc.UA.UAEndpointDescriptor");
$EndpointDescriptor->UrlString = 
    //"http://opcua.demo-this.com:51211/UA/SampleServer";
    //"https://opcua.demo-this.com:51212/UA/SampleServer/";
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";

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

// Obtain variables under "Server" node
$ServerNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ServerNodeId->StandardName = "Server";

try
{
    $NodeElements = $Client->BrowseDataVariables($EndpointDescriptor, $ServerNodeId->ExpandedText);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

// Display results
foreach ($NodeElements as $NodeElement)
{
    printf("\n");
    printf("nodeElement.NodeId: %s\n", $NodeElement->NodeId);
    printf("nodeElement.NodeId.ExpandedText: %s\n", $NodeElement->NodeId->ExpandedText);
    printf("nodeElement.DisplayName: %s\n", $NodeElement->DisplayName);
}

// Example output:
//
//nodeElement.NodeId: Server_ServerStatus
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
//nodeElement.DisplayName: ServerStatus

REM This example shows how to obtain data variables under the "Server" node
REM in the address space.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseDataVariables_Main_Command_Click()
    OutputText = ""

    Dim endpointDescriptor As String
    'endpointDescriptor = "http://opcua.demo-this.com:51211/UA/SampleServer"
    'endpointDescriptor = "https://opcua.demo-this.com:51212/UA/SampleServer/"
    endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Obtain variables under "Server" node
    Dim serverNodeId As New UANodeId
    serverNodeId.StandardName = "Server"
    
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseDataVariables(endpointDescriptor, serverNodeId.expandedText)
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId: " & NodeElement.NodeId & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.expandedText & vbCrLf
        OutputText = OutputText & "nodeElement.DisplayName: " & NodeElement.DisplayName & vbCrLf
    Next
    
    ' Example output:
    '
    'nodeElement.NodeId: Server_ServerStatus
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
    'nodeElement.DisplayName: ServerStatus
End Sub
Rem This example shows how to obtain data variables under the "Server" node in the address space.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim endpointDescriptor: endpointDescriptor = _
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    '"http://opcua.demo-this.com:51211/UA/SampleServer"  
    '"https://opcua.demo-this.com:51212/UA/SampleServer/"

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

' Obtain variables under "Server" node
Dim ServerNodeId: Set ServerNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ServerNodeId.StandardName = "Server"
On Error Resume Next
Dim NodeElementCollection: Set NodeElementCollection = Client.BrowseDataVariables(endpointDescriptor, ServerNodeId.ExpandedText)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElementCollection
    WScript.Echo 
    WScript.Echo "nodeElement.NodeId: " & NodeElement.NodeId
    WScript.Echo "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.ExpandedText
    WScript.Echo "nodeElement.DisplayName: " & NodeElement.DisplayName
Next

' Example output:
'
'nodeElement.NodeId: Server_ServerStatus
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
'nodeElement.DisplayName: ServerStatus

.NET

// This example shows how to obtain objects under the "Server" node in the address space.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples._EasyUAClient
{
    class BrowseObjects
    {
        public static void Overload2()
        {
            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 objects under "Server" node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseObjects(endpointDescriptor, UAObjectIds.Server);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Console.WriteLine();
                Console.WriteLine($"nodeElement.DisplayName: {nodeElement.DisplayName}");
                Console.WriteLine($"nodeElement.NodeId: {nodeElement.NodeId}");
                Console.WriteLine($"nodeElement.NodeId.ExpandedText: {nodeElement.NodeId.ExpandedText}");
            }
        }

        // Example output:
        //
        //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
    }
}
# This example shows how to obtain objects under the "Server" node in the address space.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard
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/"

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

# Obtain objects under "Server" node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseObjects($client, 
        $endpointDescriptor, [UAObjectIds]::Server)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

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


# Example output:
#
#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

# This example shows how to obtain objects under 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 .
# 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 *


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 objects under "Server" node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseObjects(client,
                                                                 endpointDescriptor,
                                                                 UANodeDescriptor(UAObjectIds.Server))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    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 objects under the "Server" node in the address space.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Friend Class BrowseObjects
        Public Shared Sub Overload2()

            ' 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 objects under "Server" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseObjects(endpointDescriptor, UAObjectIds.Server)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement

            ' Example output:
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2268
            'nodeElement.DisplayName: ServerCapabilities
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2274
            'nodeElement.DisplayName: ServerDiagnostics
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2295
            'nodeElement.DisplayName: VendorServerInfo
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2296
            'nodeElement.DisplayName: ServerRedundancy
        End Sub
    End Class
End Namespace

COM

// This example shows how to obtain objects under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseObjects.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
  ServerNodeId: _UANodeId;
begin
  EndpointDescriptor := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';

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

  // Obtain objects under "Server" node
  ServerNodeId := CoUANodeId.Create;
  ServerNodeId.StandardName := 'Server';
  try
    NodeElements := Client.BrowseObjects(EndpointDescriptor, ServerNodeId.ExpandedText);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  // Display results
  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn;
    WriteLn('nodeElement.NodeId: ', NodeElement.NodeId.ToString);
    WriteLn('nodeElement.NodeId.ExpandedText: ', NodeElement.NodeId.ExpandedText);
    WriteLn('nodeElement.DisplayName: ', NodeElement.DisplayName);
  end;

  // Example output:
  //
  //nodeElement.NodeId: Server_ServerCapabilities
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2268
  //nodeElement.DisplayName: ServerCapabilities
  //
  //nodeElement.NodeId: Server_ServerDiagnostics
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2274
  //nodeElement.DisplayName: ServerDiagnostics
  //
  //nodeElement.NodeId: Server_VendorServerInfo
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2295
  //nodeElement.DisplayName: VendorServerInfo
  //
  //nodeElement.NodeId: Server_ServerRedundancy
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2296
  //nodeElement.DisplayName: ServerRedundancy
  //
  //nodeElement.NodeId: Server_Namespaces
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11715
  //nodeElement.DisplayName: Namespaces

end;
// This example shows how to obtain objects under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

$EndpointDescriptor = new COM("OpcLabs.EasyOpc.UA.UAEndpointDescriptor");
$EndpointDescriptor->UrlString = 
    //"http://opcua.demo-this.com:51211/UA/SampleServer";
    //"https://opcua.demo-this.com:51212/UA/SampleServer/";
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";

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

// Obtain variables under "Server" node
$ServerNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ServerNodeId->StandardName = "Server";

try
{
    $NodeElements = $Client->BrowseObjects($EndpointDescriptor, $ServerNodeId->ExpandedText);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

// Display results
foreach ($NodeElements as $NodeElement)
{
    printf("\n");
    printf("nodeElement.NodeId: %s\n", $NodeElement->NodeId);
    printf("nodeElement.NodeId.ExpandedText: %s\n", $NodeElement->NodeId->ExpandedText);
    printf("nodeElement.DisplayName: %s\n", $NodeElement->DisplayName);
}

// Example output:
//
//nodeElement.NodeId: Server_ServerCapabilities
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2268
//nodeElement.DisplayName: ServerCapabilities
//
//nodeElement.NodeId: Server_ServerDiagnostics
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2274
//nodeElement.DisplayName: ServerDiagnostics
//
//nodeElement.NodeId: Server_VendorServerInfo
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2295
//nodeElement.DisplayName: VendorServerInfo
//
//nodeElement.NodeId: Server_ServerRedundancy
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2296
//nodeElement.DisplayName: ServerRedundancy
//
//nodeElement.NodeId: Server_Namespaces
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11715
//nodeElement.DisplayName: Namespaces

REM This example shows how to obtain objects under the "Server" node
REM in the address space.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseObjects_Main_Command_Click()
    OutputText = ""

    Dim endpointDescriptor As String
    'endpointDescriptor = "http://opcua.demo-this.com:51211/UA/SampleServer"
    'endpointDescriptor = "https://opcua.demo-this.com:51212/UA/SampleServer/"
    endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Obtain objects under "Server" node
    Dim serverNodeId As New UANodeId
    serverNodeId.StandardName = "Server"
    
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseObjects(endpointDescriptor, serverNodeId.expandedText)
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId: " & NodeElement.NodeId & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.expandedText & vbCrLf
        OutputText = OutputText & "nodeElement.DisplayName: " & NodeElement.DisplayName & vbCrLf
    Next
    
    ' Example output:
    '
    'nodeElement.NodeId: Server_ServerCapabilities
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2268
    'nodeElement.DisplayName: ServerCapabilities
    '
    'nodeElement.NodeId: Server_ServerDiagnostics
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2274
    'nodeElement.DisplayName: ServerDiagnostics
    '
    'nodeElement.NodeId: Server_VendorServerInfo
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2295
    'nodeElement.DisplayName: VendorServerInfo
    '
    'nodeElement.NodeId: Server_ServerRedundancy
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2296
    'nodeElement.DisplayName: ServerRedundancy
    '
    'nodeElement.NodeId: Server_Namespaces
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11715
    'nodeElement.DisplayName: Namespaces
End Sub
Rem This example shows how to obtain objects under the "Server" node in the address space.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim endpointDescriptor: endpointDescriptor = _
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    '"http://opcua.demo-this.com:51211/UA/SampleServer"  
    '"https://opcua.demo-this.com:51212/UA/SampleServer/"

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

' Obtain objects under "Server" node
Dim ServerNodeId: Set ServerNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ServerNodeId.StandardName = "Server"
On Error Resume Next
Dim NodeElementCollection: Set NodeElementCollection = Client.BrowseObjects(endpointDescriptor, ServerNodeId.ExpandedText)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElementCollection
    WScript.Echo 
    WScript.Echo "nodeElement.NodeId: " & NodeElement.NodeId
    WScript.Echo "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.ExpandedText
    WScript.Echo "nodeElement.DisplayName: " & NodeElement.DisplayName
Next

' Example output:
'
'nodeElement.NodeId: Server_ServerCapabilities
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2268
'nodeElement.DisplayName: ServerCapabilities
'
'nodeElement.NodeId: Server_ServerDiagnostics
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2274
'nodeElement.DisplayName: ServerDiagnostics
'
'nodeElement.NodeId: Server_VendorServerInfo
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2295
'nodeElement.DisplayName: VendorServerInfo
'
'nodeElement.NodeId: Server_ServerRedundancy
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2296
'nodeElement.DisplayName: ServerRedundancy
'
'nodeElement.NodeId: Server_Namespaces
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=11715
'nodeElement.DisplayName: Namespaces

.NET

// This example shows how to obtain properties under the "Server" node in the address space.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples._EasyUAClient
{
    class BrowseProperties
    {
        public static void Overload2()
        {
            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 properties under "Server" node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseProperties(endpointDescriptor, UAObjectIds.Server);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Console.WriteLine();
                Console.WriteLine($"nodeElement.DisplayName: {nodeElement.DisplayName}");
                Console.WriteLine($"nodeElement.NodeId: {nodeElement.NodeId}");
                Console.WriteLine($"nodeElement.NodeId.ExpandedText: {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: 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
    }
}
# This example shows how to obtain properties under the "Server" node in the address space.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.AddressSpace.Standard
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/"

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

# Obtain objects under "Server" node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseProperties($client, 
        $endpointDescriptor, [UAObjectIds]::Server)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

# Display results
foreach ($nodeElement in $nodeElementCollection) {
    Write-Host
    Write-Host "nodeElement.DisplayName: $($nodeElement.DisplayName)"
    Write-Host "nodeElement.NodeId: $($nodeElement.NodeId)"
    Write-Host "nodeElement.NodeId.ExpandedText: $($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: 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

# This example shows how to obtain properties under 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 .
# 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 *


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 objects under "Server" node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseProperties(client,
                                                                    endpointDescriptor,
                                                                    UANodeDescriptor(UAObjectIds.Server))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    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 properties under the "Server" node in the address space.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Friend Class BrowseProperties
        Public Shared Sub Overload2()

            ' 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 properties under "Server" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseProperties(endpointDescriptor, UAObjectIds.Server)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement

            ' Example output:
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2254
            'nodeElement.DisplayName: ServerArray
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2255
            'nodeElement.DisplayName: NamespaceArray
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2267
            'nodeElement.DisplayName: ServiceLevel
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2994
            'nodeElement.DisplayName: Auditing            }
        End Sub
    End Class
End Namespace

COM

// This example shows how to obtain properties under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseProperties.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
  ServerNodeId: _UANodeId;
begin
  EndpointDescriptor := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';

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

  // Obtain properties under "Server" node
  ServerNodeId := CoUANodeId.Create;
  ServerNodeId.StandardName := 'Server';
  try
    NodeElements := Client.BrowseProperties(EndpointDescriptor, ServerNodeId.ExpandedText);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  // Display results
  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn;
    WriteLn('nodeElement.NodeId: ', NodeElement.NodeId.ToString);
    WriteLn('nodeElement.NodeId.ExpandedText: ', NodeElement.NodeId.ExpandedText);
    WriteLn('nodeElement.DisplayName: ', NodeElement.DisplayName);
  end;

  // Example output:
  //
  //nodeElement.NodeId: Server_ServerArray
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
  //nodeElement.DisplayName: ServerArray
  //
  //nodeElement.NodeId: Server_NamespaceArray
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
  //nodeElement.DisplayName: NamespaceArray
  //
  //nodeElement.NodeId: Server_ServiceLevel
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
  //nodeElement.DisplayName: ServiceLevel
  //
  //nodeElement.NodeId: Server_Auditing
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
  //nodeElement.DisplayName: Auditing

end;
// This example shows how to obtain properties under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

$EndpointDescriptor = new COM("OpcLabs.EasyOpc.UA.UAEndpointDescriptor");
$EndpointDescriptor->UrlString = 
    //"http://opcua.demo-this.com:51211/UA/SampleServer";
    //"https://opcua.demo-this.com:51212/UA/SampleServer/";
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";

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

// Obtain variables under "Server" node
$ServerNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ServerNodeId->StandardName = "Server";

try
{
    $NodeElements = $Client->BrowseProperties($EndpointDescriptor, $ServerNodeId->ExpandedText);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    exit();
}

// Display results
foreach ($NodeElements as $NodeElement)
{
    printf("\n");
    printf("nodeElement.NodeId: %s\n", $NodeElement->NodeId);
    printf("nodeElement.NodeId.ExpandedText: %s\n", $NodeElement->NodeId->ExpandedText);
    printf("nodeElement.DisplayName: %s\n", $NodeElement->DisplayName);
}

// Example output:
//
//nodeElement.NodeId: Server_ServerArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
//nodeElement.DisplayName: ServerArray
//
//nodeElement.NodeId: Server_NamespaceArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
//nodeElement.DisplayName: NamespaceArray
//
//nodeElement.NodeId: Server_ServiceLevel
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
//nodeElement.DisplayName: ServiceLevel
//
//nodeElement.NodeId: Server_Auditing
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
//nodeElement.DisplayName: Auditing

REM This example shows how to obtain properties under the "Server" node
REM in the address space.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseProperties_Main_Command_Click()
    OutputText = ""

    Dim endpointDescriptor As String
    'endpointDescriptor = "http://opcua.demo-this.com:51211/UA/SampleServer"
    'endpointDescriptor = "https://opcua.demo-this.com:51212/UA/SampleServer/"
    endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Obtain properties under "Server" node
    Dim serverNodeId As New UANodeId
    serverNodeId.StandardName = "Server"
    
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseProperties(endpointDescriptor, serverNodeId.expandedText)
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId: " & NodeElement.NodeId & vbCrLf
        OutputText = OutputText & "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.expandedText & vbCrLf
        OutputText = OutputText & "nodeElement.DisplayName: " & NodeElement.DisplayName & vbCrLf
    Next
    
    ' Example output:
    '
    'nodeElement.NodeId: Server_ServerArray
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
    'nodeElement.DisplayName: ServerArray
    '
    'nodeElement.NodeId: Server_NamespaceArray
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
    'nodeElement.DisplayName: NamespaceArray
    '
    'nodeElement.NodeId: Server_ServiceLevel
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
    'nodeElement.DisplayName: ServiceLevel
    '
    'nodeElement.NodeId: Server_Auditing
    'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
    'nodeElement.DisplayName: Auditing
End Sub
Rem This example shows how to obtain properties under the "Server" node in the address space.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim endpointDescriptor: endpointDescriptor = _
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    '"http://opcua.demo-this.com:51211/UA/SampleServer"  
    '"https://opcua.demo-this.com:51212/UA/SampleServer/"

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

' Obtain properties under "Server" node
Dim ServerNodeId: Set ServerNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ServerNodeId.StandardName = "Server"
On Error Resume Next
Dim NodeElementCollection: Set NodeElementCollection = Client.BrowseProperties(endpointDescriptor, ServerNodeId.ExpandedText)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElementCollection
    WScript.Echo 
    WScript.Echo "nodeElement.NodeId: " & NodeElement.NodeId
    WScript.Echo "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.ExpandedText
    WScript.Echo "nodeElement.DisplayName: " & NodeElement.DisplayName
Next

' Example output:
'
'nodeElement.NodeId: Server_ServerArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
'nodeElement.DisplayName: ServerArray
'
'nodeElement.NodeId: Server_NamespaceArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
'nodeElement.DisplayName: NamespaceArray
'
'nodeElement.NodeId: Server_ServiceLevel
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
'nodeElement.DisplayName: ServiceLevel
'
'nodeElement.NodeId: Server_Auditing
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
'nodeElement.DisplayName: Auditing

.NET

// This example shows how to obtain all method 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 .

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

namespace UADocExamples._EasyUAClient
{
    class BrowseMethods
    {
        public static void Overload2()
        {
            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 methods under the specified node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseMethods(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755");
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

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

        // Example output:
        //ScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10756
        //ScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10759
        //ScalarMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10762
        //ArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10765
        //ArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10768
        //ArrayMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10771
        //UserScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10774
        //UserScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10777
        //UserArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10780
        //UserArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10783
    }
}
# This example shows how to obtain all method 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 .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
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/"

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

# Obtain methods under the specified node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseMethods($client, 
        $endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755")
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

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


# Example output:
#
#ScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10756
#ScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10759
#ScalarMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10762
#ArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10765
#ArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10768
#ArrayMethod3: nsu = http://test.org/UA/Data/ ;ns=2;i=10771
#UserScalarMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10774
#UserScalarMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10777
#UserArrayMethod1: nsu = http://test.org/UA/Data/ ;ns=2;i=10780
#UserArrayMethod2: nsu = http://test.org/UA/Data/ ;ns=2;i=10783

# This example shows how to obtain all method 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 .
# 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.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 methods under the specified node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseMethods(client,
                                                                 endpointDescriptor,
                                                                 UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10755'))
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    print(nodeElement.BrowseName, ': ', nodeElement.NodeId, sep='')
' This example shows how to obtain all method 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 .

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

Namespace _EasyUAClient
    Friend Class BrowseMethods
        Public Shared Sub Overload2()

            ' 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 methods under the specified node.
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseMethods(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10755")
            Catch uaException As UAException
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}")
                Exit Sub
            End Try

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

        ' Example output:
        'ScalarMethod1 nsu = http  'test.org/UA/Data/ ;ns=2;i=10756
        'ScalarMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10759
        'ScalarMethod3: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10762
        'ArrayMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10765
        'ArrayMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10768
        'ArrayMethod3: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10771
        'UserScalarMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10774
        'UserScalarMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10777
        'UserArrayMethod1: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10780
        'UserArrayMethod2: nsu = http : 'test.org/UA/Data/ ;ns=2;i=10783
    End Class
End Namespace

COM

// This example shows how to obtain all method 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 .

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "BrowseMethods.h"

namespace _EasyUAClient
{
    void BrowseMethods::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            // Instantiate the client object
            _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));

            // Perform the operation
            _UANodeElementCollectionPtr NodeElementsPtr = ClientPtr->BrowseMethods(
                //L"http://opcua.demo-this.com:51211/UA/SampleServer", 
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer",
                L"nsu=http://test.org/UA/Data/ ;i=10755");
    
            // Display results
            IEnumVARIANTPtr EnumNodeElementPtr = NodeElementsPtr->GetEnumerator();
            _variant_t vNodeElement;
            while (EnumNodeElementPtr->Next(1, &vNodeElement, NULL) == S_OK)
            {
                _UANodeElementPtr NodeElementPtr(vNodeElement);
                _tprintf(_T("%s: "), (LPCTSTR)CW2CT(NodeElementPtr->BrowseName->ToString));
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(NodeElementPtr->NodeId->ToString));
                vNodeElement.Clear();
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
// This example shows how to obtain all method 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 .

class procedure BrowseMethods.Main;
var
  Client: EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  NodeElements := Client.BrowseMethods(
    //'http://opcua.demo-this.com:51211/UA/SampleServer',
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
    'nsu=http://test.org/UA/Data/ ;i=10755');

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// This example shows how to obtain all method 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 .

class procedure BrowseMethods.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  try
    NodeElements := Client.BrowseMethods(
      //'http://opcua.demo-this.com:51211/UA/SampleServer',
      //'https://opcua.demo-this.com:51212/UA/SampleServer/',
      'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
      'nsu=http://test.org/UA/Data/ ;i=10755');
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;

  // Example output:
  // ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756
  // ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759
  // ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762
  // ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765
  // ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768
  // ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771
  // UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774
  // UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777
  // UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780
  // UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783

end;
// This example shows how to obtain all method 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 .

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

// Perform the operation
try
{
    $NodeElements = $Client->BrowseMethods(
        //"http://opcua.demo-this.com:51211/UA/SampleServer", 
        "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", 
        "nsu=http://test.org/UA/Data/ ;i=10755");
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    Exit();
}


// Display results
foreach ($NodeElements as $NodeElement)
{
    printf(" s\n", $NodeElement->BrowseName, $NodeElement->NodeId);
}
REM This example shows how to obtain all method nodes under a given node of the OPC-UA address space.
REM For each node, it displays its browse name and node ID.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseMethods_Main_Command_Click()
    OutputText = ""

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Perform the operation
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755")
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & NodeElement.BrowseName & ": " & NodeElement.NodeId & vbCrLf
    Next
End Sub
Rem This example shows how to obtain all method nodes under a given node of the OPC-UA address space. 
Rem For each node, it displays its browse name and node ID.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

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

' Perform the operation
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo NodeElement.BrowseName & ": " & NodeElement.NodeId
Next


' Example output:
'ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756
'ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759
'ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762
'ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765
'ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768
'ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771
'UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774
'UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777
'UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780
'UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783

More Examples

// This example shows how to obtain "data nodes" under the "Objects" node, recursively.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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 BrowseDataNodes
    {
        public static void Recursive()
        {
            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();

            try
            {
                BrowseFromNode(client, endpointDescriptor, UAObjectIds.ObjectsFolder, level:0);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
            }
        }

        private static void BrowseFromNode(
            EasyUAClient client,
            UAEndpointDescriptor endpointDescriptor,
            UANodeDescriptor parentNodeDescriptor,
            int level)
        {
            Debug.Assert(!(client is null));
            Debug.Assert(!(endpointDescriptor is null));
            Debug.Assert(!(parentNodeDescriptor is null));

            // Obtain all node elements under parentNodeDescriptor
            UANodeElementCollection nodeElementCollection = 
                client.BrowseDataNodes(endpointDescriptor, parentNodeDescriptor);
            // Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.

            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Debug.Assert(!(nodeElement is null));

                Console.Write(new string(' ', level*2));    // indent
                Console.WriteLine(nodeElement);

                // Browse recursively into the node.
                // The UANodeElement has an implicit conversion to UANodeDescriptor.
                BrowseFromNode(client, endpointDescriptor, nodeElement, level + 1);

                // Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
                // Production code should contain appropriate safeguards for these cases.
            }
        }


        // Example output:
        //
        //ServerStatus -> nsu=http://opcfoundation.org/UA/ ;i=2256 (Variable) 
        //  StartTime -> nsu=http://opcfoundation.org/UA/ ;i=2257 (Variable) 
        //  CurrentTime -> nsu=http://opcfoundation.org/UA/ ;i=2258 (Variable) 
        //  State -> nsu=http://opcfoundation.org/UA/ ;i=2259 (Variable) 
        //  BuildInfo -> nsu=http://opcfoundation.org/UA/ ;i=2260 (Variable) 
        //    ProductUri -> nsu=http://opcfoundation.org/UA/ ;i=2262 (Variable) 
        //    ManufacturerName -> nsu=http://opcfoundation.org/UA/ ;i=2263 (Variable) 
        //    ProductName -> nsu=http://opcfoundation.org/UA/ ;i=2261 (Variable) 
        //    SoftwareVersion -> nsu=http://opcfoundation.org/UA/ ;i=2264 (Variable) 
        //    BuildNumber -> nsu=http://opcfoundation.org/UA/ ;i=2265 (Variable) 
        //    BuildDate -> nsu=http://opcfoundation.org/UA/ ;i=2266 (Variable) 
        //  SecondsTillShutdown -> nsu=http://opcfoundation.org/UA/ ;i=2992 (Variable) 
        //  ShutdownReason -> nsu=http://opcfoundation.org/UA/ ;i=2993 (Variable) 
        //ServerCapabilities -> nsu=http://opcfoundation.org/UA/ ;i=2268 (Object) 
        //  OperationLimits -> nsu=http://opcfoundation.org/UA/ ;i=11704 (Object) 
        //    MaxNodesPerRead -> nsu=http://opcfoundation.org/UA/ ;i=11705 (Variable) 
        //    MaxNodesPerHistoryReadData -> nsu=http://opcfoundation.org/UA/ ;i=12165 (Variable) 
        //    MaxNodesPerHistoryReadEvents -> nsu=http://opcfoundation.org/UA/ ;i=12166 (Variable) 
        //    MaxNodesPerWrite -> nsu=http://opcfoundation.org/UA/ ;i=11707 (Variable) 
        //    MaxNodesPerHistoryUpdateData -> nsu=http://opcfoundation.org/UA/ ;i=12167 (Variable) 
        //...
    }
}
# This example shows how to obtain "data nodes" under the "Objects" node, recursively.
#
# 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 .
# 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 *


def browseFromNode(client, endpointDescriptor, parentNodeDescriptor, level):
    assert client is not None
    assert endpointDescriptor is not None
    assert parentNodeDescriptor is not None

    # Obtain all node elements under parentNodeDescriptor
    nodeElementCollection = IEasyUAClientExtension.BrowseDataNodes(client, endpointDescriptor, parentNodeDescriptor)
    # Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.
    #
    for nodeElement in nodeElementCollection:
        assert nodeElement is not None

        print(' '*(level*2), end='')    # indent
        print(nodeElement)

        # Browse recursively into the node.
        # The UANodeElement has an implicit conversion to UANodeDescriptor.
        browseFromNode(client, endpointDescriptor, nodeElement.ToUANodeDescriptor(), level + 1)

        # Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
        # Production code should contain appropriate safeguards for these cases.


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()

try:
    browseFromNode(client, endpointDescriptor, UANodeDescriptor(UAObjectIds.ObjectsFolder), 0)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

print()
print('Finished.')
' This example shows how to obtain "data nodes" under the "Objects" node, recursively.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Partial Friend Class BrowseDataNodes
        Public Shared Sub Recursive()

            ' 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()
            Try
                BrowseFromNode(client, endpointDescriptor, UAObjectIds.ObjectsFolder, level:=0)
            Catch uaException As UAException
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}")
                Exit Sub
            End Try
        End Sub

        Private Shared Sub BrowseFromNode(client As EasyUAClient, endPointDescriptor As UAEndpointDescriptor, parentNodeDescriptor As UANodeDescriptor, level As Integer)
            Debug.Assert(client IsNot Nothing)
            Debug.Assert(endPointDescriptor IsNot Nothing)
            Debug.Assert(parentNodeDescriptor IsNot Nothing)

            ' Obtain all node elements under parentNodeDescriptor
            Dim nodeElementCollection As UANodeElementCollection =
                client.BrowseDataNodes(endPointDescriptor, parentNodeDescriptor)
            ' Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.

            For Each nodeElement As UANodeElement In nodeElementCollection
                Debug.Assert(nodeElement IsNot Nothing)

                Console.Write(New String(" "c, level * 2))
                Console.WriteLine(nodeElement)

                ' Browse recursively into the node.
                ' The UANodeElement has an implicit conversion to UANodeDescriptor.
                BrowseFromNode(client, endPointDescriptor, nodeElement, level + 1)

                ' Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
                ' Production code should contain appropriate safeguards for these cases.
            Next nodeElement
        End Sub
    End Class
End Namespace

 

 

Example

.NET

.NET

// This example shows how to obtain "data nodes" (objects, variables and properties) under the "Objects" node in the address
// space.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace UADocExamples._EasyUAClient
{
    partial class BrowseDataNodes
    {
        public static void Overload1()
        {
            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 data nodes under "Objects" node.
            UANodeElementCollection nodeElementCollection;
            try
            {
                nodeElementCollection = client.BrowseDataNodes(endpointDescriptor);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
                return;
            }

            // Display results
            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Console.WriteLine();
                Console.WriteLine($"nodeElement.DisplayName: {nodeElement.DisplayName}");
                Console.WriteLine($"nodeElement.NodeId: {nodeElement.NodeId}");
                Console.WriteLine($"nodeElement.NodeId.ExpandedText: {nodeElement.NodeId.ExpandedText}");
            }
        }

        // Example output:
        //
        //nodeElement.DisplayName: Server
        //nodeElement.NodeId: Server
        //nodeElement.NodeId.ExpandedText: nsu = http://opcfoundation.org/UA/ ;i=2253
        //
        //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: MemoryBuffers
        //nodeElement.NodeId: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
        //nodeElement.NodeId.ExpandedText: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
    }
}
# This example shows how to obtain "data nodes" (objects, variables and properties) under the "Objects" node in the address
# space.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
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/"

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

# Obtain data nodes under "Objects" node.
try {
    $nodeElementCollection = [IEasyUAClientExtension]::BrowseDataNodes($client, $endpointDescriptor)
}
catch [UAException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

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


# Example output:
#
#nodeElement.DisplayName: Server
#nodeElement.NodeId: Server
#nodeElement.NodeId.ExpandedText: nsu = http://opcfoundation.org/UA/ ;i=2253
#
#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: MemoryBuffers
#nodeElement.NodeId: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
#nodeElement.NodeId.ExpandedText: nsu = http://samples.org/UA/memorybuffer ;ns=7;i=1025
# This example shows how to obtain all data nodes (objects and variables) 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 .
# 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.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 data nodes under "Objects" node.
try:
    nodeElementCollection = IEasyUAClientExtension.BrowseDataNodes(client, endpointDescriptor)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

# Display results.
for nodeElement in nodeElementCollection:
    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 "data nodes" (objects, variables and properties) under the "Objects" node in the address
' space.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Friend Class BrowseDataNodes
        Public Shared Sub Overload1()

            ' 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 data nodes under "Objects" node
            Dim nodeElementCollection As UANodeElementCollection
            Try
                nodeElementCollection = client.BrowseDataNodes(endpointDescriptor)
            Catch uaException As UAException
                Console.WriteLine("*** Failure: {0}", uaException.GetBaseException.Message)
                Exit Sub
            End Try

            ' Display results
            For Each nodeElement As UANodeElement In nodeElementCollection
                Console.WriteLine()
                Console.WriteLine("nodeElement.NodeId: {0}", nodeElement.NodeId)
                Console.WriteLine("nodeElement.DisplayName: {0}", nodeElement.DisplayName)
            Next nodeElement

            ' Example output:
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/;i=2253
            'nodeElement.DisplayName: Server
            '
            'nodeElement.NodeId: nsu=http://test.org/UA/Data/ ;i=10157
            'nodeElement.DisplayName: Data
            '
            'nodeElement.NodeId: nsu=http://opcfoundation.org/UA/Boiler/;i=1240
            'nodeElement.DisplayName: Boilers
            '
            'nodeElement.NodeId: nsu=http://samples.org/UA/memorybuffer;i=1025
            'nodeElement.DisplayName: MemoryBuffers            
        End Sub
    End Class
End Namespace
// This example shows how to obtain "data nodes" under the "Objects" node, recursively.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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 BrowseDataNodes
    {
        public static void Recursive()
        {
            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();

            try
            {
                BrowseFromNode(client, endpointDescriptor, UAObjectIds.ObjectsFolder, level:0);
            }
            catch (UAException uaException)
            {
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}");
            }
        }

        private static void BrowseFromNode(
            EasyUAClient client,
            UAEndpointDescriptor endpointDescriptor,
            UANodeDescriptor parentNodeDescriptor,
            int level)
        {
            Debug.Assert(!(client is null));
            Debug.Assert(!(endpointDescriptor is null));
            Debug.Assert(!(parentNodeDescriptor is null));

            // Obtain all node elements under parentNodeDescriptor
            UANodeElementCollection nodeElementCollection = 
                client.BrowseDataNodes(endpointDescriptor, parentNodeDescriptor);
            // Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.

            foreach (UANodeElement nodeElement in nodeElementCollection)
            {
                Debug.Assert(!(nodeElement is null));

                Console.Write(new string(' ', level*2));    // indent
                Console.WriteLine(nodeElement);

                // Browse recursively into the node.
                // The UANodeElement has an implicit conversion to UANodeDescriptor.
                BrowseFromNode(client, endpointDescriptor, nodeElement, level + 1);

                // Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
                // Production code should contain appropriate safeguards for these cases.
            }
        }


        // Example output:
        //
        //ServerStatus -> nsu=http://opcfoundation.org/UA/ ;i=2256 (Variable) 
        //  StartTime -> nsu=http://opcfoundation.org/UA/ ;i=2257 (Variable) 
        //  CurrentTime -> nsu=http://opcfoundation.org/UA/ ;i=2258 (Variable) 
        //  State -> nsu=http://opcfoundation.org/UA/ ;i=2259 (Variable) 
        //  BuildInfo -> nsu=http://opcfoundation.org/UA/ ;i=2260 (Variable) 
        //    ProductUri -> nsu=http://opcfoundation.org/UA/ ;i=2262 (Variable) 
        //    ManufacturerName -> nsu=http://opcfoundation.org/UA/ ;i=2263 (Variable) 
        //    ProductName -> nsu=http://opcfoundation.org/UA/ ;i=2261 (Variable) 
        //    SoftwareVersion -> nsu=http://opcfoundation.org/UA/ ;i=2264 (Variable) 
        //    BuildNumber -> nsu=http://opcfoundation.org/UA/ ;i=2265 (Variable) 
        //    BuildDate -> nsu=http://opcfoundation.org/UA/ ;i=2266 (Variable) 
        //  SecondsTillShutdown -> nsu=http://opcfoundation.org/UA/ ;i=2992 (Variable) 
        //  ShutdownReason -> nsu=http://opcfoundation.org/UA/ ;i=2993 (Variable) 
        //ServerCapabilities -> nsu=http://opcfoundation.org/UA/ ;i=2268 (Object) 
        //  OperationLimits -> nsu=http://opcfoundation.org/UA/ ;i=11704 (Object) 
        //    MaxNodesPerRead -> nsu=http://opcfoundation.org/UA/ ;i=11705 (Variable) 
        //    MaxNodesPerHistoryReadData -> nsu=http://opcfoundation.org/UA/ ;i=12165 (Variable) 
        //    MaxNodesPerHistoryReadEvents -> nsu=http://opcfoundation.org/UA/ ;i=12166 (Variable) 
        //    MaxNodesPerWrite -> nsu=http://opcfoundation.org/UA/ ;i=11707 (Variable) 
        //    MaxNodesPerHistoryUpdateData -> nsu=http://opcfoundation.org/UA/ ;i=12167 (Variable) 
        //...
    }
}
# This example shows how to obtain "data nodes" under the "Objects" node, recursively.
#
# 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 .
# 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 *


def browseFromNode(client, endpointDescriptor, parentNodeDescriptor, level):
    assert client is not None
    assert endpointDescriptor is not None
    assert parentNodeDescriptor is not None

    # Obtain all node elements under parentNodeDescriptor
    nodeElementCollection = IEasyUAClientExtension.BrowseDataNodes(client, endpointDescriptor, parentNodeDescriptor)
    # Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.
    #
    for nodeElement in nodeElementCollection:
        assert nodeElement is not None

        print(' '*(level*2), end='')    # indent
        print(nodeElement)

        # Browse recursively into the node.
        # The UANodeElement has an implicit conversion to UANodeDescriptor.
        browseFromNode(client, endpointDescriptor, nodeElement.ToUANodeDescriptor(), level + 1)

        # Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
        # Production code should contain appropriate safeguards for these cases.


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()

try:
    browseFromNode(client, endpointDescriptor, UANodeDescriptor(UAObjectIds.ObjectsFolder), 0)
except UAException as uaException:
    print('*** Failure: ' + uaException.GetBaseException().Message)
    exit()

print()
print('Finished.')
' This example shows how to obtain "data nodes" under the "Objects" node, recursively.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

Namespace _EasyUAClient
    Partial Friend Class BrowseDataNodes
        Public Shared Sub Recursive()

            ' 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()
            Try
                BrowseFromNode(client, endpointDescriptor, UAObjectIds.ObjectsFolder, level:=0)
            Catch uaException As UAException
                Console.WriteLine($"*** Failure: {uaException.GetBaseException().Message}")
                Exit Sub
            End Try
        End Sub

        Private Shared Sub BrowseFromNode(client As EasyUAClient, endPointDescriptor As UAEndpointDescriptor, parentNodeDescriptor As UANodeDescriptor, level As Integer)
            Debug.Assert(client IsNot Nothing)
            Debug.Assert(endPointDescriptor IsNot Nothing)
            Debug.Assert(parentNodeDescriptor IsNot Nothing)

            ' Obtain all node elements under parentNodeDescriptor
            Dim nodeElementCollection As UANodeElementCollection =
                client.BrowseDataNodes(endPointDescriptor, parentNodeDescriptor)
            ' Remark: BrowseDataNodes(...) may throw UAException; we handle it in the calling method.

            For Each nodeElement As UANodeElement In nodeElementCollection
                Debug.Assert(nodeElement IsNot Nothing)

                Console.Write(New String(" "c, level * 2))
                Console.WriteLine(nodeElement)

                ' Browse recursively into the node.
                ' The UANodeElement has an implicit conversion to UANodeDescriptor.
                BrowseFromNode(client, endPointDescriptor, nodeElement, level + 1)

                ' Note that the number of nodes you obtain through recursive browsing may be very large, or even infinite.
                ' Production code should contain appropriate safeguards for these cases.
            Next nodeElement
        End Sub
    End Class
End Namespace
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement
            OpcLabs.EasyOpc.UA.Graphs.UANodeTreePosition

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