OPC Studio User's Guide and Reference
UAAttributeId Enumeration
Example Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace : UAAttributeId Enumeration
Id of an attribute in OPC UA address space.
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComVisibleAttribute(True)>
<DisplayName2Attribute("OPC-UA Attribute ID")>
<GuidAttribute("8EE73726-1F43-492A-89FD-01E0B5E9907E")>
Public Enum UAAttributeId 
   Inherits System.Enum
   Implements System.IComparable, System.IConvertible, System.IFormattable 
'Usage
 
Dim instance As UAAttributeId
[CLSCompliant(true)]
[ComVisible(true)]
[DisplayName2("OPC-UA Attribute ID")]
[Guid("8EE73726-1F43-492A-89FD-01E0B5E9907E")]
public enum UAAttributeId : System.Enum, System.IComparable, System.IConvertible, System.IFormattable  
[CLSCompliant(true)]
[ComVisible(true)]
[DisplayName2("OPC-UA Attribute ID")]
[Guid("8EE73726-1F43-492A-89FD-01E0B5E9907E")]
public enum class UAAttributeId : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable  
Members
MemberValueDescription
AccessLevel17How a variable may be accessed.
AccessLevelEx27How a variable may be accessed.

Remarks:

This attribute has been added in OPC UA 1.04.

AccessRestrictions26The access restrictions assigned to the node.

Remarks:

This attribute has been added in OPC UA 1.04.

ArrayDimensions16The length for each dimension of an array value.
BrowseName3A non-localized, human readable name for the node.
ContainsNoLoops11Indicates that following forward references within a view will not cause a loop.
DataType14The node id of the data type for the variable value.
DataTypeDefinition23Provides the metadata and encoding information for custom DataTypes.

Remarks:

This attribute has been added in OPC UA 1.04.

Description5A localized description for the node.
DisplayName4A localized, human readable name for the node.
EventNotifier12Indicates that the node can be used to subscribe to events.
Executable21Whether the method can be called.
Historizing20Specifies whether the server is actively collecting historical data for the variable.
InverseName10The browse name for an inverse reference.
IsAbstract8Indicates that a type node may not be instantiated.
MinimumSamplingInterval19Specifies (in milliseconds) how fast the server can reasonably sample the value for changes.
NodeClass2The class of the node.
NodeId1The canonical identifier for the node.
None0No attribute.
RolePermissions24The permissions for the node granted to roles.

Remarks:

This attribute has been added in OPC UA 1.04.

Symmetric9Indicates that forward and inverse references have the same meaning.
UserAccessLevel18How a variable may be accessed after taking the user's access rights into account.
UserExecutable22Whether the method can be called by the current user.
UserRolePermissions25The subset of permissions available for the roles available to the current session.

Remarks:

This attribute has been added in OPC UA 1.04.

UserWriteMask7Indicates which attributes are writable by the current user.
Value13The value of a variable.
ValueRank15The number of dimensions in the value.
WriteMask6Indicates which attributes are writable.
Remarks

Attribute:
"A primitive characteristic of a Node. All Attributes are defined by OPC UA, and may not be defined by Clients or Servers. Attributes are the only elements in the AddressSpace permitted to have data values."

An Attribute ID in OPC UA is a numeric identifier that specifies which attribute of a node is being referred to. Attributes are "properties" of nodes (although OPC UA Properties are a different concept); for example, a node representing a temperature sensor might have attributes for its current value, data type, and description. The Attribute ID allows clients to request or manipulate specific attributes of a node.

Common OPC UA Attributes

Some of the standard attributes defined in OPC UA, along with their typical Attribute IDs, are:

Usage

Clients use Attribute IDs when reading or writing node attributes, or subscribing to changes in a node's value. For example, a client might request the Value attribute of a variable node to get its current value or the DisplayName attribute to show a user-friendly name in the interface.

Example
// This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also possible 
// to read multiple attributes of the same node.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

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

namespace UADocExamples._EasyUAClient
{
    partial class ReadMultipleValues
    {
        public static void DataType()
        {
            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 values.
            ValueResult[] valueResultArray = client.ReadMultipleValues(new[]
                {
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845", UAAttributeId.DataType),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", UAAttributeId.DataType),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855", UAAttributeId.DataType)
                });

            // Display results.
            foreach (ValueResult valueResult in valueResultArray)
            {
                Console.WriteLine();

                if (valueResult.Succeeded)
                {
                    Console.WriteLine($"Value: {valueResult.Value}");
                    var dataTypeId = valueResult.Value as UANodeId;
                    if (!(dataTypeId is null))
                    {
                        Console.WriteLine($"Value.ExpandedText: {dataTypeId.ExpandedText}");
                        Console.WriteLine($"Value.NamespaceUriString: {dataTypeId.NamespaceUriString}");
                        Console.WriteLine($"Value.NamespaceIndex: {dataTypeId.NamespaceIndex}");
                        Console.WriteLine($"Value.NumericIdentifier: {dataTypeId.NumericIdentifier}");
                    }
                }
                else
                    Console.WriteLine($"*** Failure: {valueResult.ErrorMessageBrief}");
            }

            // Example output:
            //
            //Value: SByte
            //Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2
            //Value.NamespaceUriString: http://opcfoundation.org/UA/
            //Value.NamespaceIndex: 0
            //Value.NumericIdentifier: 2
            //
            //Value: Float
            //Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=10
            //Value.NamespaceUriString: http://opcfoundation.org/UA/
            //Value.NamespaceIndex: 0
            //Value.NumericIdentifier: 10
            //
            //Value: String
            //Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=12
            //Value.NamespaceUriString: http://opcfoundation.org/UA/
            //Value.NamespaceIndex: 0
            //Value.NumericIdentifier: 12
        }
    }
}
# This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also possible 
# to read multiple attributes of the same node.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in PowerShell on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PowerShell .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.AddressSpace
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 values. 
$valueResultArray = $client.ReadMultipleValues([UAReadArguments[]]@(
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845", [UAAttributeId]::DataType)), 
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", [UAAttributeId]::DataType)), 
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855", [UAAttributeId]::DataType))
    ))

foreach ($valueResult in $valueResultArray) {
    Write-Host

    if ($valueResult.Succeeded) {
        Write-Host "Value: $($valueResult.Value)"
        [UANodeId]$dataTypeId = $valueResult.Value;
        if ($dataTypeId -ne $null) {
            Write-Host "Value.ExpandedText: $($dataTypeId.ExpandedText)"
            Write-Host "Value.NamespaceUriString: $($dataTypeId.NamespaceUriString)"
            Write-Host "Value.NamespaceIndex: $($dataTypeId.NamespaceIndex)"
            Write-Host "Value.NumericIdentifier: $($dataTypeId.NumericIdentifier)"
        }
    }
    else {
        Write-Host "*** Failure: $($valueResult.ErrorMessageBrief)"
    }
}


# Example output:
#
#Value: SByte
#Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2
#Value.NamespaceUriString: http://opcfoundation.org/UA/
#Value.NamespaceIndex: 0
#Value.NumericIdentifier: 2
#
#Value: Float
#Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=10
#Value.NamespaceUriString: http://opcfoundation.org/UA/
#Value.NamespaceIndex: 0
#Value.NumericIdentifier: 10
#
#Value: String
#Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=12
#Value.NamespaceUriString: http://opcfoundation.org/UA/
#Value.NamespaceIndex: 0
#Value.NumericIdentifier: 12
' This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also possible 
' to read multiple attributes of the same node.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports System
Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.AddressSpace
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Partial Friend Class ReadMultipleValues
        Public Shared Sub DataType()

            ' 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 values.
            Dim valueResultArray() As ValueResult = client.ReadMultipleValues(New UAReadArguments() _
               {
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845", UAAttributeId.DataType),
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", UAAttributeId.DataType),
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855", UAAttributeId.DataType)
               }
            )

            ' Display results
            For Each valueResult As ValueResult In valueResultArray
                Console.WriteLine()

                If valueResult.Succeeded Then
                    Console.WriteLine("Value: {0}", valueResult.Value)
                    Dim dataTypeId = CType(valueResult.Value, UANodeId)
                    If Not dataTypeId Is Nothing Then
                        Console.WriteLine("Value.ExpandedText: {0}", dataTypeId.ExpandedText)
                        Console.WriteLine("Value.NamespaceUriString: {0}", dataTypeId.NamespaceUriString)
                        Console.WriteLine("Value.NamespaceIndex: {0}", dataTypeId.NamespaceIndex)
                        Console.WriteLine("Value.NumericIdentifier: {0}", dataTypeId.NumericIdentifier)
                    End If
                Else
                    Console.WriteLine("*** Failure: {0}", valueResult.ErrorMessageBrief)
                End If
            Next valueResult

            ' Example output:
            '
            'Value: SByte
            'Value.ExpandedText: nsu = http : //opcfoundation.org/UA/ ;i=2
            'Value.NamespaceUriString: http : //opcfoundation.org/UA/
            'Value.NamespaceIndex: 0
            'Value.NumericIdentifier: 2
            '
            'Value: Float
            'Value.ExpandedText: nsu = http : //opcfoundation.org/UA/ ;i=10
            'Value.NamespaceUriString: http : //opcfoundation.org/UA/
            'Value.NamespaceIndex: 0
            'Value.NumericIdentifier: 10
            '
            'Value: String
            'Value.ExpandedText: nsu = http : //opcfoundation.org/UA/ ;i=12
            'Value.NamespaceUriString: http : //opcfoundation.org/UA/
            'Value.NamespaceIndex: 0
            'Value.NumericIdentifier: 12
        End Sub
    End Class
End Namespace
// This example shows how to read the DataType attributes of 3 different nodes at
// once. Using the same method, it is also possible to read multiple attributes
// of the same node.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

class procedure ReadMultipleValues.DataType;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  ReadArguments1, ReadArguments2, ReadArguments3: _UAReadArguments;
  Arguments, Results: OleVariant;
  I: Cardinal;
  Result: _ValueResult;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  ReadArguments1 := CoUAReadArguments.Create;
  ReadArguments1.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';
  ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10845';
  ReadArguments1.AttributeId := UAAttributeId_DataType;

  ReadArguments2 := CoUAReadArguments.Create;
  ReadArguments2.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';
  ReadArguments2.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10853';
  ReadArguments2.AttributeId := UAAttributeId_DataType;

  ReadArguments3 := CoUAReadArguments.Create;
  ReadArguments3.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';
  ReadArguments3.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/ ;i=10855';
  ReadArguments3.AttributeId := UAAttributeId_DataType;

  Arguments := VarArrayCreate([0, 2], varVariant);
  Arguments[0] := ReadArguments1;
  Arguments[1] := ReadArguments2;
  Arguments[2] := ReadArguments3;

  // Obtain values. By default, the Value attributes of the nodes will be read.
  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(Client.ReadMultipleValues(Arguments));

  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
      Result := IInterface(Results[I]) as _ValueResult;
      WriteLn;
      if Result.Succeeded then
      begin
          WriteLn('Value: ', Result.Value);
          WriteLn('Value.ExpandedText: ', Result.Value.ExpandedText);
          WriteLn('Value.NamespaceUriString: ', Result.Value.NamespaceUriString);
          WriteLn('Value.NamespaceIndex: ', Result.Value.NamespaceIndex);
          WriteLn('Value.NumericIdentifier: ', Result.Value.NumericIdentifier);
      end
      else
        WriteLn('results(', I, ') *** Failure: ', Result.ErrorMessageBrief);
  end;
  
  VarClear(Results);
  VarClear(Arguments);

  // Example output:
  //
  //
  //Value: SByte
  //Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=2
  //Value.NamespaceUriString: http://opcfoundation.org/UA/
  //Value.NamespaceIndex: 0
  //Value.NumericIdentifier: 2
  //
  //Value: Float
  //Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=10
  //Value.NamespaceUriString: http://opcfoundation.org/UA/
  //Value.NamespaceIndex: 0
  //Value.NumericIdentifier: 10
  //
  //Value: String
  //Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=12
  //Value.NamespaceUriString: http://opcfoundation.org/UA/
  //Value.NamespaceIndex: 0
  //Value.NumericIdentifier: 12
end;
// This example shows how to read the DataType attributes of 3 different nodes at
// once. Using the same method, it is also possible to read multiple attributes
// of the same node.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in PHP on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-PHP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

const UAAttributeId_DataType = 14;

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

$ReadArguments1 = new COM("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments");
$ReadArguments1->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";
$ReadArguments1->NodeDescriptor->NodeId->ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10845";
$ReadArguments1->AttributeId = UAAttributeId_DataType;

$ReadArguments2 = new COM("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments");
$ReadArguments2->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";
$ReadArguments2->NodeDescriptor->NodeId->ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10853";
$ReadArguments2->AttributeId = UAAttributeId_DataType;

$ReadArguments3 = new COM("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments");
$ReadArguments3->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";
$ReadArguments3->NodeDescriptor->NodeId->ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10855";
$ReadArguments3->AttributeId = UAAttributeId_DataType;

$arguments[0] = $ReadArguments1;
$arguments[1] = $ReadArguments2;
$arguments[2] = $ReadArguments3;

// Obtain values. By default, the Value attributes of the nodes will be read.
$results = $Client->ReadMultipleValues($arguments);

// Display results
for ($i = 0; $i < count($results); $i++)
{
    $ValueResult = $results[$i];
    printf("\n");
    if ($ValueResult->Succeeded)
    {
        printf("Value: %s\n", $ValueResult->Value);
        printf("Value.ExpandedText: %s\n", $ValueResult->Value->ExpandedText);
        printf("Value.NamespaceUriString: %s\n", $ValueResult->Value->NamespaceUriString);
        printf("Value.NamespaceIndex: %s\n", $ValueResult->Value->NamespaceIndex);
        printf("Value.NumericIdentifier: %s\n", $ValueResult->Value->NumericIdentifier);
    }
    else
        printf("*** Failure: %s\n", $ValueResult->ErrorMessageBrief);
}

// Example output:
//
//
//Value: SByte
//Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=2
//Value.NamespaceUriString: http://opcfoundation.org/UA/
//Value.NamespaceIndex: 0
//Value.NumericIdentifier: 2
//
//Value: Float
//Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=10
//Value.NamespaceUriString: http://opcfoundation.org/UA/
//Value.NamespaceIndex: 0
//Value.NumericIdentifier: 10
//
//Value: String
//Value.ExpandedText: nsu=http://opcfoundation.org/UA/;i=12
//Value.NamespaceUriString: http://opcfoundation.org/UA/
//Value.NamespaceIndex: 0
//Value.NumericIdentifier: 12
Rem This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also possible 
Rem to read multiple attributes of the same node.
Rem
Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript .
Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
Rem a commercial license in order to use Online Forums, and we reply to every post.

Option Explicit

Const UAAttributeId_DataType = 14

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

Dim ReadArguments1: Set ReadArguments1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArguments1.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
ReadArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10845"
ReadArguments1.AttributeId = UAAttributeId_DataType

Dim ReadArguments2: Set ReadArguments2 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArguments2.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
ReadArguments2.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10853"
ReadArguments2.AttributeId = UAAttributeId_DataType

Dim ReadArguments3: Set ReadArguments3 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArguments3.EndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
ReadArguments3.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/ ;i=10855"
ReadArguments3.AttributeId = UAAttributeId_DataType

Dim arguments(2)
Set arguments(0) = ReadArguments1
Set arguments(1) = ReadArguments2
Set arguments(2) = ReadArguments3

' Obtain values.
Dim results: results = Client.ReadMultipleValues(arguments)

' Display results
Dim i: For i = LBound(results) To UBound(results)
    WScript.Echo

    Dim ValueResult: Set ValueResult = results(i)
    If ValueResult.Succeeded Then
        WScript.Echo "Value: " & ValueResult.Value
        On Error Resume Next
        WScript.Echo "Value.ExpandedText: " & ValueResult.Value.ExpandedText
        WScript.Echo "Value.NamespaceUriString: " & ValueResult.Value.NamespaceUriString
        WScript.Echo "Value.NamespaceIndex: " & ValueResult.Value.NamespaceIndex
        WScript.Echo "Value.NumericIdentifier: " & ValueResult.Value.NumericIdentifier
        On Error Goto 0
    Else
        WScript.Echo "*** Failure: " & ValueResult.ErrorMessageBrief
    End If
Next

' Example output:
'
'Value: SByte
'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2
'Value.NamespaceUriString: http://opcfoundation.org/UA/
'Value.NamespaceIndex: 0
'Value.NumericIdentifier: 2
'
'Value: Float
'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=10
'Value.NamespaceUriString: http://opcfoundation.org/UA/
'Value.NamespaceIndex: 0
'Value.NumericIdentifier: 10
'
'Value: String
'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=12
'Value.NamespaceUriString: http://opcfoundation.org/UA/
'Value.NamespaceIndex: 0
'Value.NumericIdentifier: 12
REM This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also possible
REM to read multiple attributes of the same node.
REM
REM Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
REM OPC client and subscriber examples in Visual Basic on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VB .
REM Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
REM a commercial license in order to use Online Forums, and we reply to every post.

Public Sub ReadMultipleValues_DataType_Command_Click()
    OutputText = ""
    
    ' Instantiate the client object
    Dim Client As New EasyUAClient

    Dim readArguments1 As New UAReadArguments
    readArguments1.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    readArguments1.nodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10845"
    readArguments1.AttributeId = UAAttributeId_DataType

    Dim ReadArguments2 As New UAReadArguments
    ReadArguments2.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    ReadArguments2.nodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10853"
    ReadArguments2.AttributeId = UAAttributeId_DataType

    Dim ReadArguments3 As New UAReadArguments
    ReadArguments3.endpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
    ReadArguments3.nodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/ ;i=10855"
    ReadArguments3.AttributeId = UAAttributeId_DataType

    Dim arguments(2) As Variant
    Set arguments(0) = readArguments1
    Set arguments(1) = ReadArguments2
    Set arguments(2) = ReadArguments3

    ' Obtain values.
    Dim results() As Variant
    results = Client.ReadMultipleValues(arguments)

    ' Display results
    Dim i: For i = LBound(results) To UBound(results)
        OutputText = OutputText & vbCrLf
        
        Dim Result As valueResult: Set Result = results(i)
        If Result.Succeeded Then
            OutputText = OutputText & "Value: " & Result.value & vbCrLf
            On Error Resume Next
            OutputText = OutputText & "Value.ExpandedText: " & Result.value.expandedText & vbCrLf
            OutputText = OutputText & "Value.NamespaceUriString: " & Result.value.NamespaceUriString & vbCrLf
            OutputText = OutputText & "Value.NamespaceIndex: " & Result.value.NamespaceIndex & vbCrLf
            OutputText = OutputText & "Value.NumericIdentifier: " & Result.value.NumericIdentifier & vbCrLf
            On Error GoTo 0
        Else
            OutputText = OutputText & "*** Failure: " & Result.ErrorMessageBrief & vbCrLf
        End If
    Next

    ' Example output:
    '
    'Value: SByte
    'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2
    'Value.NamespaceUriString: http://opcfoundation.org/UA/
    'Value.NamespaceIndex: 0
    'Value.NumericIdentifier: 2
    '
    'Value: Float
    'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=10
    'Value.NamespaceUriString: http://opcfoundation.org/UA/
    'Value.NamespaceIndex: 0
    'Value.NumericIdentifier: 10
    '
    'Value: String
    'Value.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=12
    'Value.NamespaceUriString: http://opcfoundation.org/UA/
    'Value.NamespaceIndex: 0
    'Value.NumericIdentifier: 12
End Sub
# This example shows how to read the DataType attributes of 3 different nodes at once. Using the same method, it is also
# possible to read multiple attributes of the same node.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# 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 values. By default, the Value attributes of the nodes will be read.
valueResultArray = IEasyUAClientExtension.ReadMultipleValues(client, [
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10845'),
                    UAAttributeId.DataType),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853'),
                    UAAttributeId.DataType),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10855'),
                    UAAttributeId.DataType),
    ])

# Display results.
for valueResult in valueResultArray:
    print()
    #
    if valueResult.Succeeded:
        print('Value: ', valueResult.Value, sep='')
        if isinstance(valueResult.Value, UANodeId):
            dataTypeId = valueResult.Value
            print('dataTypeId.ExpandedText: ', dataTypeId.ExpandedText, sep='')
            print('dataTypeId.NamespaceUriString: ', dataTypeId.NamespaceUriString, sep='')
            print('dataTypeId.NamespaceIndex: ', dataTypeId.NamespaceIndex, sep='')
            print('dataTypeId.NumericIdentifier: ', dataTypeId.NumericIdentifier, sep='')
    else:
        print('*** Failure: ', valueResult.ErrorMessageBrief, sep='')

print()
print('Finished.')
Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         OpcLabs.EasyOpc.UA.UAAttributeId

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