OPC Studio User's Guide and Reference
DAPropertyArguments Class
Members 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.DataAccess.OperationModel Namespace : DAPropertyArguments Class
Holds an OPC server, OPC node and OPC property descriptors, as arguments to some operation.
Object Model
DAPropertyArguments ClassDANodeDescriptor ClassDAPropertyDescriptor ClassServerDescriptor ClassDANodeDescriptor ClassDAPropertyDescriptor ClassServerDescriptor Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments)>
<ComVisibleAttribute(True)>
<GuidAttribute("D310A9B5-12AB-4B1C-9D65-801E1336EB8F")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<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 NotInheritable Class DAPropertyArguments 
   Inherits OpcLabs.BaseLib.OperationModel.OperationArguments
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.OperationModel.ComTypes._OperationArguments, OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As DAPropertyArguments
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments)]
[ComVisible(true)]
[Guid("D310A9B5-12AB-4B1C-9D65-801E1336EB8F")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[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 sealed class DAPropertyArguments : OpcLabs.BaseLib.OperationModel.OperationArguments, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.OperationModel.ComTypes._OperationArguments, OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments)]
[ComVisible(true)]
[Guid("D310A9B5-12AB-4B1C-9D65-801E1336EB8F")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[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 DAPropertyArguments sealed : public OpcLabs.BaseLib.OperationModel.OperationArguments, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.BaseLib.OperationModel.ComTypes._OperationArguments, OpcLabs.EasyOpc.DataAccess.OperationModel.ComTypes._DAPropertyArguments, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks

 

Each OPC item has typically associated a set of OPC properties with it. OPC properties contain additional information related to the item.

Except in special cases with clear justification, do not use the OPC Classic property mechanism to get "dynamic" properties such as Value, Quality, or Timestamp. Doing so is very inefficient and has additional issues associated with it (reliability, consistency). Use normal read or subscriptions instead.

A single property

If you want to obtain the value of specific OPC property, call the GetPropertyValue method, passing it the machine name, server class, the ItemId, and a PropertyId. You will receive back an Object (a VARIANT in QuickOPC-COM) containing the value of the requested property.

In QuickOPC.NET, you can also pass in the ServerDescriptor inplace of the machine name and server class strings.

In addition to basic methods, there are also many property-related methods. Please refer to a chapter in this document that describes EasyOPC.NET Extensions.

OPC Data Access

Basic example

.NET

// This example shows how to get a value of a single OPC property.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
// also subscribe to the item in order to assure that it remains active.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace DocExamples.DataAccess._EasyDAClient
{
    partial class GetPropertyValue
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            object value;
            try
            {
                value = client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random",
                    DAPropertyIds.Timestamp);
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            Console.WriteLine(value);
        }
    }
}
# This example shows how to get a value of a single OPC property.
#
# Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
# case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
# IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
# also subscribe to the item in order to assure that it remains active.
#
# 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.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object
client = EasyDAClient()

# Perform the operation
try:
    value = IEasyDAClientExtension.GetPropertyValue(client,
        '', 'OPCLabs.KitServer.2', 'Simulation.Random', DAPropertyId(DAPropertyIds.Timestamp))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results
print('value: ', value, sep='')
' This example shows how to get a value of a single OPC property.
'
' Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
' case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
' IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
' also subscribe to the item in order to assure that it remains active.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel

Namespace DataAccess._EasyDAClient
    Partial Friend Class GetPropertyValue
        Public Shared Sub Main1()
            Dim client = New EasyDAClient()

            Dim value As Object
            Try
                value = client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random", DAPropertyIds.Timestamp)
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine(value)
        End Sub
    End Class
End Namespace

COM

// This example shows how to get a value of a single OPC property.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
// also subscribe to the item in order to assure that it remains active.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

const Timestamp = 4;

$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");

try
{
    $value = $Client->GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random", Timestamp);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    Exit();
}

printf("%s\n", $value);
# This example shows how to get a value of a single OPC property.
#
# Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
# case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
# IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
# also subscribe to the item in order to assure that it remains active.
#
# 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

TIMESTAMP = 4

# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.DataAccess.EasyDAClient') 

# Perform the operation
try:
    value = client.GetPropertyValue('', 'OPCLabs.KitServer.2', 'Simulation.Random', TIMESTAMP)
except com_error as e:
    print('*** Failure: ' + e.args[2][1] + ': ' + e.args[2][2])
    exit()

# Display results
print('value: ', value)
Rem This example shows how to get a value of a single OPC property.
Rem
Rem Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
Rem case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
Rem IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
Rem also subscribe to the item in order to assure that it remains active.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Const Timestamp = 4

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")

On Error Resume Next
Dim value: value = Client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random", Timestamp)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

WScript.Echo value

Example with time measurement

Rem This example measures the time needed to get values of all OPC properties of a single OPC item "one by one".
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"

Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor")
NodeDescriptor.ItemID = "Simulation.ReadValue_I4"

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")

Dim PropertyElementCollection
On Error Resume Next
Set PropertyElementCollection = Client.BrowseProperties(ServerDescriptor, NodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

'EasyDAClient.ReadItemValue "", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4"
Dim startTime: startTime = Timer
Dim PropertyElement: For Each PropertyElement In PropertyElementCollection
    Dim propertyID: Set propertyID = PropertyElement.PropertyID
    On Error Resume Next
    Dim value: value = Client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4", propertyID.NumericalValue)
    If Err.Number <> 0 Then
        WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
        WScript.Quit
    End If
    On Error Goto 0
    'WScript.Echo value
Next
WScript.Echo "Time taken (milliseconds): " & (Timer - startTime)*1000

Example with type casting

The GetPropertyValue Method returns a generic object, regardless of the property involved. You may therefore need to cast the returned value to the expected type, and possibly do further processing on the value, as in the the example below.

// This example shows how to obtain a data type of an OPC item.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.BaseLib.ComInterop;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClient
{
    partial class GetPropertyValue
    {
        public static void DataType()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            // Get the value of DataType property; it is a 16-bit signed integer
            short dataType;
            try
            {
                dataType = (short)client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random",
                    DAPropertyIds.DataType);
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }
            // Convert the data type to VarType
            var varType = (VarType)dataType;

            // Display the obtained data type
            Console.WriteLine("DataType: {0}", dataType);   // Display data type as numerical value
            Console.WriteLine("VarType: {0}", varType);     // Display data type symbolically

            // Code below illustrates how decisions can be made based on type
            switch (varType.InternalValue)
            {
                case VarTypes.R8:
                    Console.WriteLine("The data type is VarTypes.R8, as we expected.");
                    break;

                // other cases may come here ...

                default:
                    Console.WriteLine("The data type is not as we expected!");
                    break;
            }
        }
    }
}
# This example shows how to obtain a data type of an OPC item.
#
# 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.BaseLib.ComInterop import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object.
client = EasyDAClient()

# Get the value of DataType property; it is a 16-bit signed integer.
try:
    dataType = IEasyDAClientExtension.GetPropertyValue(client,
        '', 'OPCLabs.KitServer.2', 'Simulation.Random', DAPropertyId(DAPropertyIds.DataType))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()
# Convert the data type to VarType.
varType = VarType(dataType)

# Display the obtained data type.
print('DataType: ', dataType, sep='')   # Display data type as numerical value
print('VarType: ', varType, sep='')     # Display data type symbolically

# Code below illustrates how decisions can be made based on type
if varType.InternalValue == VarTypes.R8:
    print('The data type is VarTypes.R8, as we expected.')
# other cases may come here ...
else:
    print('The data type is not as we expected!')
' This example shows how to obtain a data type of an OPC item.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.BaseLib.ComInterop
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel

Namespace DataAccess._EasyDAClient
    Partial Friend Class GetPropertyValue
        Public Shared Sub DataType()
            Dim client = New EasyDAClient()

            ' Get the value of DataType property; it is a 16-bit signed integer
            Dim aDataType As Short
            Try
                aDataType = CShort(Fix(client.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.Random", DAPropertyIds.DataType)))
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            ' Convert the data type to VarType
            Dim varType = CType(aDataType, VarType)

            ' Display the obtained data type
            Console.WriteLine("DataType: {0}", aDataType) ' Display data type as numerical value
            Console.WriteLine("VarType: {0}", varType) ' Display data type symbolically

            ' Code below illustrates how decisions can be made based on type
            Select Case varType
                Case VarTypes.R8
                    Console.WriteLine("The data type is VarTypes.R8, as we expected.")

                    ' other cases may come here ...

                Case Else
                    Console.WriteLine("The data type is not as we expected!")
            End Select
        End Sub
    End Class
End Namespace

 

OPC XML-DA

// This example shows how to get a value of a single OPC XML-DA property.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
// also subscribe to the item in order to assure that it remains active.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace DocExamples.DataAccess.Xml
{
    partial class GetPropertyValue
    {
        public static void Main1Xml()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            object value;
            try
            {
                value = client.GetPropertyValue("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx", "Dynamic/Analog Types/Int",
                    DAPropertyDescriptor.Timestamp);
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            Console.WriteLine(value);
        }
    }
}
# This example shows how to get a value of a single OPC XML-DA property.
#
# 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 import *
from OpcLabs.EasyOpc.DataAccess import *

# Instantiate the client object.
client = EasyDAClient()

# Perform the operation
try:
    value = IEasyDAClientExtension.GetPropertyValue(client, ServerDescriptor('http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx'), DANodeDescriptor('Dynamic/Analog Types/Int'), 
                                                    DAPropertyDescriptor(DAPropertyId(DAPropertyDescriptor.Timestamp)))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message, sep='')
    exit()

# Display results
print('value: ', value, sep='')
' This example shows how to get a value of a single OPC XML-DA property.
'
' Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
' case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
' IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may 
' also subscribe to the item in order to assure that it remains active.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel

Namespace DataAccess.Xml
    Partial Friend Class GetPropertyValue
        Public Shared Sub Main1Xml()
            Dim client = New EasyDAClient()

            Dim value As Object
            Try
                value = client.GetPropertyValue("http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx", "Dynamic/Analog Types/Int", DAPropertyDescriptor.Timestamp)
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine(value)
        End Sub
    End Class
End Namespace

 

QuickOPC supports OPC XML-DA also on Linux and macOS.

 

Multiple properties

For obtaining multiple properties simultaneously in an efficient manner, call the GetMultiplePropertyValues method (instead of multiple GetPropertyValue calls in a loop). The arguments are similar, except that in place of a single PropertyId you pass in an array of them. You will receive back an array of Object values (a SAFEARRAY of VARIANT values in QuickOPC-COM).

OPC Data Access

Basic example

.NET

// This example shows how to get value of multiple OPC properties, and handle errors.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
// code may also subscribe to the items in order to assure that they remain active.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace DocExamples.DataAccess._EasyDAClient
{
    partial class GetMultiplePropertyValues
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            ServerDescriptor serverDescriptor = "OPCLabs.KitServer.2";

            // Get the values of Timestamp and AccessRights properties of two items.
            ValueResult[] results = client.GetMultiplePropertyValues(new[]
            {
                new DAPropertyArguments(serverDescriptor, "Simulation.Random", DAPropertyDescriptor.Timestamp),
                new DAPropertyArguments(serverDescriptor, "Simulation.Random", DAPropertyDescriptor.AccessRights),
                new DAPropertyArguments(serverDescriptor, "Trends.Ramp (1 min)", DAPropertyDescriptor.Timestamp),
                new DAPropertyArguments(serverDescriptor, "Trends.Ramp (1 min)", DAPropertyDescriptor.AccessRights)
            });

            for (int i = 0; i < results.Length; i++)
            {
                ValueResult valueResult = results[i];
                if (valueResult.Exception is null)
                    Console.WriteLine($"results({i}).Value: {valueResult.Value}");
                else
                    Console.WriteLine($"results({i}).Exception.Message: {valueResult.Exception.Message}");
            }
        }
    }
}
# This example shows how to get value of multiple OPC properties, and handle errors.
#
# Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
# case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run
# IEasyDAClient.ReadItemValue.Main.vbs shortly before this example, in order to obtain better property values. Your code may
# also subscribe to the item in order to assure that it remains active.
#
# 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 import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.OperationModel import *
from OpcLabs.EasyOpc.OperationModel import *


serverDescriptor = ServerDescriptor('OPCLabs.KitServer.2')

# Instantiate the client object.
client = EasyDAClient()

# Get the values of Timestamp and AccessRights properties of two items.
resultArray = client.GetMultiplePropertyValues([
    DAPropertyArguments(serverDescriptor, DAItemDescriptor('Simulation.Random'), DAPropertyDescriptor.Timestamp),
    DAPropertyArguments(serverDescriptor, DAItemDescriptor('Simulation.Random'), DAPropertyDescriptor.AccessRights),
    DAPropertyArguments(serverDescriptor, DAItemDescriptor('Trends.Ramp (1 min)'), DAPropertyDescriptor.Timestamp),
    DAPropertyArguments(serverDescriptor, DAItemDescriptor('Trends.Ramp (1 min)'), DAPropertyDescriptor.AccessRights),
    ])

# Display results
for i, valueResult in enumerate(resultArray):
    valueResult = resultArray[i]
    if valueResult.Exception is None:
        print('resultArray[', i, '].Value: ', valueResult.Value, sep='')
    else:
        print('resultArray[', i, '].Exception.Message: ', valueResult.Exception.Message, sep='')
# This example shows how to get value of multiple OPC properties, and handle errors.
#
# Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
# case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
# IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
# code may also subscribe to the items in order to assure that they remain active.
#
# 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.OperationModel
using namespace OpcLabs.EasyOpc
using namespace OpcLabs.EasyOpc.DataAccess
using namespace OpcLabs.EasyOpc.DataAccess.OperationModel

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

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

$serverDescriptor = New-Object ServerDescriptor("OPCLabs.KitServer.2")

# Get the values of Timestamp and AccessRights properties of two items.
$results = $client.GetMultiplePropertyValues(@(
    (New-Object DAPropertyArguments($serverDescriptor, "Simulation.Random", [DAPropertyDescriptor]::Timestamp)),
    (New-Object DAPropertyArguments($serverDescriptor, "Simulation.Random", [DAPropertyDescriptor]::AccessRights)),
    (New-Object DAPropertyArguments($serverDescriptor, "Trends.Ramp (1 min)", [DAPropertyDescriptor]::Timestamp)),
    (New-Object DAPropertyArguments($serverDescriptor, "Trends.Ramp (1 min)", [DAPropertyDescriptor]::AccessRights))
    ))

for ($i = 0; $i -lt $results.Length; $i++) {
    $valueResult = $results[$i]
    if ($valueResult.Exception -eq $null) {
        Write-Host "results($($i)).Value: $($valueResult.Value)"
    }
    else {
        Write-Host "results($($i)).Exception.Message: $($valueResult.Exception.Message)"
    }
}
' This example shows how to get value of multiple OPC properties, and handle errors.
'
' Note that some properties may not have a useful value initially (e.g. until the item Is activated in a group), which also the
' case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
' IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
' code may also subscribe to the items in order to assure that they remain active.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.OperationModel

Namespace DataAccess._EasyDAClient
    Partial Friend Class GetMultiplePropertyValues
        Shared Sub Main1()
            ' Instantiate the client object.
            Dim client = New EasyDAClient()

            Dim serverDescriptor As ServerDescriptor = "OPCLabs.KitServer.2"

            ' Get the values of Timestamp and AccessRights properties of two items.
            Dim results() As ValueResult = client.GetMultiplePropertyValues(New DAPropertyArguments() {
                New DAPropertyArguments(serverDescriptor, "Simulation.Random", DAPropertyDescriptor.Timestamp),
                New DAPropertyArguments(serverDescriptor, "Simulation.Random", DAPropertyDescriptor.AccessRights),
                New DAPropertyArguments(serverDescriptor, "Trends.Ramp (1 min)", DAPropertyDescriptor.Timestamp),
                New DAPropertyArguments(serverDescriptor, "Trends.Ramp (1 min)", DAPropertyDescriptor.AccessRights)
             })

            For i = 0 To results.Length - 1
                Dim valueResult As ValueResult = results(i)
                If valueResult.Exception Is Nothing Then
                    Console.WriteLine($"results({i}).Value: {valueResult.Value}")
                Else
                    Console.WriteLine($"results({i}).Exception.Message: {valueResult.Exception.Message}")
                End If
            Next i

        End Sub

    End Class
End Namespace

COM

// This example shows how to get value of multiple OPC properties.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run
// IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your
// code may also subscribe to the items in order to assure that they remain active.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure GetMultiplePropertyValues.Main;
var
  Arguments: OleVariant;
  Client: OpcLabs_EasyOpcClassic_TLB._EasyDAClient;
  I: Cardinal;
  PropertyArguments1: _DAPropertyArguments;
  PropertyArguments2: _DAPropertyArguments;
  PropertyArguments3: _DAPropertyArguments;
  PropertyArguments4: _DAPropertyArguments;
  ValueResult: _ValueResult;
  Results: OleVariant;
begin

  // Get the values of Timestamp and AccessRights properties of two items.

  PropertyArguments1 := CoDAPropertyArguments.Create;
  PropertyArguments1.ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';
  PropertyArguments1.NodeDescriptor.ItemID := 'Simulation.Random';
  PropertyArguments1.PropertyDescriptor.PropertyId.NumericalValue := DAPropertyIds_Timestamp;

  PropertyArguments2 := CoDAPropertyArguments.Create;
  PropertyArguments2.ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';
  PropertyArguments2.NodeDescriptor.ItemID := 'Simulation.Random';
  PropertyArguments2.PropertyDescriptor.PropertyId.NumericalValue := DAPropertyIds_AccessRights;

  PropertyArguments3 := CoDAPropertyArguments.Create;
  PropertyArguments3.ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';
  PropertyArguments3.NodeDescriptor.ItemID := 'Trends.Ramp (1 min)';
  PropertyArguments3.PropertyDescriptor.PropertyId.NumericalValue := DAPropertyIds_Timestamp;

  PropertyArguments4 := CoDAPropertyArguments.Create;
  PropertyArguments4.ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';
  PropertyArguments4.NodeDescriptor.ItemID := 'Trends.Ramp (1 min)';
  PropertyArguments4.PropertyDescriptor.PropertyId.NumericalValue := DAPropertyIds_AccessRights;

  Arguments := VarArrayCreate([0, 3], varVariant);
  Arguments[0] := PropertyArguments1;
  Arguments[1] := PropertyArguments2;
  Arguments[2] := PropertyArguments3;
  Arguments[3] := PropertyArguments4;

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

  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(
    Client.GetMultiplePropertyValues(Arguments));

  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
      ValueResult := IInterface(Results[I]) as _ValueResult;

      // Check if there has been an error getting the property value
      if ValueResult.Exception <> nil then
      begin
        WriteLn(Format('s *** Failures', [Arguments[I].NodeDescriptor.NodeId, ValueResult.Exception.Message]));
        Continue;
      end;

      WriteLn('results(', i, ').Value: ', ValueResult.Value);
  end;
  VarClear(Results);
  VarClear(Arguments);
end;
// This example shows how to get value of multiple OPC properties, and handle errors.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
// code may also subscribe to the items in order to assure that they remain active.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

const Timestamp = 4;
const AccessRights = 5;

// Get the values of Timestamp and AccessRights properties of two items.

$PropertyArguments1 = new COM("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments");
$PropertyArguments1->ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";
$PropertyArguments1->NodeDescriptor->ItemID = "Simulation.Random";
$PropertyArguments1->PropertyDescriptor->PropertyID->NumericalValue = Timestamp;

$PropertyArguments2 = new COM("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments");
$PropertyArguments2->ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";
$PropertyArguments2->NodeDescriptor->ItemID = "Simulation.Random";
$PropertyArguments2->PropertyDescriptor->PropertyID->NumericalValue = AccessRights;

$PropertyArguments3 = new COM("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments");
$PropertyArguments3->ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";
$PropertyArguments3->NodeDescriptor->ItemID = "Trends.Ramp (1 min)";
$PropertyArguments3->PropertyDescriptor->PropertyID->NumericalValue = Timestamp;

$PropertyArguments4 = new COM("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments");
$PropertyArguments4->ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";
$PropertyArguments4->NodeDescriptor->ItemID = "Trends.Ramp (1 min)";
$PropertyArguments4->PropertyDescriptor->PropertyID->NumericalValue = AccessRights;

$arguments[0] = $PropertyArguments1;
$arguments[1] = $PropertyArguments2;
$arguments[2] = $PropertyArguments3;
$arguments[3] = $PropertyArguments4;

$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");

$results = $Client->GetMultiplePropertyValues($arguments);

for ($i = 0; $i < count($results); $i++)
{
    $attributeDataResult = $results[$i];
    if ($results[$i]->Succeeded)
        printf("results[d].Values\n", $i, $results[$i]->Value);
    else
        printf("results[d]: *** Failures\n", $i, $results[$i]->ErrorMessageBrief);
}
REM This example shows how to get value of multiple OPC properties.
REM
REM Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
REM case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run
REM IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your
REM code may also subscribe to the items in order to assure that they remain active.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Private Sub GetMultiplePropertyValues_Main_Command_Click()
    OutputText = ""
    
    ' Get the values of Timestamp and AccessRights properties of two items.

    Dim propertyArguments1 As New DAPropertyArguments
    propertyArguments1.serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
    propertyArguments1.nodeDescriptor.itemId = "Simulation.Random"
    propertyArguments1.PropertyDescriptor.propertyId.NumericalValue = DAPropertyIds_Timestamp
    
    Dim propertyArguments2 As New DAPropertyArguments
    propertyArguments2.serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
    propertyArguments2.nodeDescriptor.itemId = "Simulation.Random"
    propertyArguments2.PropertyDescriptor.propertyId.NumericalValue = DAPropertyIds_AccessRights
    
    Dim propertyArguments3 As New DAPropertyArguments
    propertyArguments3.serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
    propertyArguments3.nodeDescriptor.itemId = "Trends.Ramp (1 min)"
    propertyArguments3.PropertyDescriptor.propertyId.NumericalValue = DAPropertyIds_Timestamp
    
    Dim propertyArguments4 As New DAPropertyArguments
    propertyArguments4.serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
    propertyArguments4.nodeDescriptor.itemId = "Trends.Ramp (1 min)"
    propertyArguments4.PropertyDescriptor.propertyId.NumericalValue = DAPropertyIds_AccessRights
    
    Dim arguments(3) As Variant
    Set arguments(0) = propertyArguments1
    Set arguments(1) = propertyArguments2
    Set arguments(2) = propertyArguments3
    Set arguments(3) = propertyArguments4

    ' Instantiate the client object
    Dim client As New EasyDAClient

    ' Obtain values. By default, the Value attributes of the nodes will be read.
    Dim results() As Variant
    results = client.GetMultiplePropertyValues(arguments)

    ' Display results
    Dim i: For i = LBound(results) To UBound(results)
        Dim valueResult As valueResult: Set valueResult = results(i)
        ' Check if there has been an error getting the property value
        If Not valueResult.Exception Is Nothing Then
            OutputText = OutputText & arguments(i).nodeDescriptor.NodeId & " *** Failure: " & valueResult.Exception.Message & vbCrLf
        Else
            OutputText = OutputText & "results(" & i & ").Value: " & valueResult.value & vbCrLf
        End If
    Next
End Sub
Rem This example shows how to get value of multiple OPC properties, and handle errors.
Rem
Rem Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
Rem case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
Rem IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
Rem code may also subscribe to the items in order to assure that they remain active.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Const Timestamp = 4
Const AccessRights = 5

' Get the values of Timestamp and AccessRights properties of two items.

Dim PropertyArguments1: Set PropertyArguments1 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
PropertyArguments1.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
PropertyArguments1.NodeDescriptor.ItemID = "Simulation.Random"
PropertyArguments1.PropertyDescriptor.PropertyID.NumericalValue = Timestamp

Dim PropertyArguments2: Set PropertyArguments2 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
PropertyArguments2.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
PropertyArguments2.NodeDescriptor.ItemID = "Simulation.Random"
PropertyArguments2.PropertyDescriptor.PropertyID.NumericalValue = AccessRights

Dim PropertyArguments3: Set PropertyArguments3 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
PropertyArguments3.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
PropertyArguments3.NodeDescriptor.ItemID = "Trends.Ramp (1 min)"
PropertyArguments3.PropertyDescriptor.PropertyID.NumericalValue = Timestamp

Dim PropertyArguments4: Set PropertyArguments4 = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
PropertyArguments4.ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"
PropertyArguments4.NodeDescriptor.ItemID = "Trends.Ramp (1 min)"
PropertyArguments4.PropertyDescriptor.PropertyID.NumericalValue = AccessRights

Dim arguments(3)
Set arguments(0) = PropertyArguments1
Set arguments(1) = PropertyArguments2
Set arguments(2) = PropertyArguments3
Set arguments(3) = PropertyArguments4

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
Dim results: results = Client.GetMultiplePropertyValues(arguments)

Dim i: For i = LBound(results) To UBound(results)
    If results(i).Exception Is Nothing Then 
        WScript.Echo "results(" & i & ").Value: " & results(i).Value
    Else
        WScript.Echo "results(" & i & ").Exception.Message: " & results(i).Exception.Message
    End If
Next

Example with time measurement

Rem This example measures the time needed to get values of all OPC properties of a single OPC item all at once.
Rem This example shows how to get value of multiple OPC properties.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"

Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor")
NodeDescriptor.ItemID = "Simulation.ReadValue_I4"

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")

Dim PropertyElementCollection
On Error Resume Next
Set PropertyElementCollection = Client.BrowseProperties(ServerDescriptor, NodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim count: count = PropertyElementCollection.Count

Dim arguments(): Redim arguments(count - 1)
Dim i: i = 0
Dim PropertyElement: For Each PropertyElement In PropertyElementCollection
    Dim PropertyArguments: Set PropertyArguments = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
    PropertyArguments.ServerDescriptor = ServerDescriptor
    PropertyArguments.NodeDescriptor = NodeDescriptor
    PropertyArguments.PropertyDescriptor.PropertyID = PropertyElement.PropertyId

    Set arguments(i) = PropertyArguments
    i = i + 1
Next

'EasyDAClient.ReadItemValue "", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4"
Dim startTime: startTime = Timer
Dim results: results = Client.GetMultiplePropertyValues(arguments)
WScript.Echo "Time taken (milliseconds): " & (Timer - startTime)*1000

'For i = LBound(results) To UBound(results)
'    If results(i).Exception Is Nothing Then 
'        WScript.Echo "results(" & i & ").Value: " & results(i).Value
'    Else
'        WScript.Echo "results(" & i & ").Exception.Message: " & results(i).Exception.Message
'    End If
''Next

Example combined with item browsing

The example below is a bit more complex, and combines the ability to browse for items with getting the data type property for each of the items obtained.

// This example shows how to obtain a data type of all OPC items under a branch.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using System.Linq;
using OpcLabs.BaseLib.ComInterop;
using OpcLabs.BaseLib.OperationModel;
using OpcLabs.EasyOpc;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.AddressSpace;

namespace DocExamples.DataAccess._EasyDAClient
{
    partial class GetMultiplePropertyValues
    {
        public static void DataType()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();
            ServerDescriptor serverDescriptor = "OPCLabs.KitServer.2";

            // Browse for all leaves under the "Simulation" branch
            DANodeElementCollection nodeElementCollection = client.BrowseLeaves(serverDescriptor, "Simulation");

            // Create list of node descriptors, one for each leaf obtained
            DANodeDescriptor[] nodeDescriptorArray = nodeElementCollection
                .Where(element => !element.IsHint)  // filter out hint leafs that do not represent real OPC items (rare)
                .Select(element => new DANodeDescriptor(element))
                .ToArray();

            // Get the value of DataType property; it is a 16-bit signed integer
            ValueResult[] valueResultArray = client.GetMultiplePropertyValues(serverDescriptor,
                nodeDescriptorArray, DAPropertyIds.DataType);

            for (int i = 0; i < valueResultArray.Length; i++)
            {
                DANodeDescriptor nodeDescriptor = nodeDescriptorArray[i];

                // Check if there has been an error getting the property value
                ValueResult valueResult = valueResultArray[i];
                if (!(valueResult.Exception is null))
                {
                    Console.WriteLine("{0} *** Failure: {1}", nodeDescriptor.NodeId, valueResult.Exception.Message);
                    continue;
                }

                // Convert the data type to VarType
                var varType = (VarType)(short)valueResult.Value;

                // Display the obtained data type
                Console.WriteLine("{0}: {1}", nodeDescriptor.ItemId, varType);
            }
        }
    }
}
# This example shows how to obtain a data type of all OPC items under a branch.
#
# 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.BaseLib.ComInterop import *
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.OperationModel import *
from OpcLabs.EasyOpc.OperationModel import *


serverDescriptor = ServerDescriptor('OPCLabs.KitServer.2')

# Instantiate the client object.
client = EasyDAClient()

# Browse for all leaves under the "Simulation" branch.
try:
    nodeElementCollection = IEasyDAClientExtension.BrowseLeaves(client, serverDescriptor, DANodeDescriptor('Simulation'))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Create list of node descriptors, one for each leaf obtained.
filteredNodeElements = filter(lambda element: not element.IsHint, nodeElementCollection)
nodeDescriptorArray = list(map(lambda element: DANodeDescriptor(element), filteredNodeElements))

# Get the value of DataType property; it is a 16-bit signed integer.
resultArray = IEasyDAClientExtension.GetMultiplePropertyValues(client,
                                                               serverDescriptor,
                                                               nodeDescriptorArray,
                                                               DAPropertyDescriptor.FromInt64(DAPropertyIds.DataType))
# Display results
for i, valueResult in enumerate(resultArray):
    nodeDescriptor = nodeDescriptorArray[i]
    # Check if there has been an error getting the property value.
    if valueResult.Exception is  None:
        # Convert the data type to VarType.
        varType = VarType(valueResult.Value)
        # Display the obtained data type.
        print(nodeDescriptor.ItemId, ': ', varType, sep='')
    else:
        print(nodeDescriptor.ItemId, ' *** Failure: ', valueResult.Exception.Message)
' This example shows how to obtain a data type of all OPC items under a branch.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.BaseLib.ComInterop
Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess

Namespace DataAccess._EasyDAClient
    Friend Class GetMultiplePropertyValues
        Public Shared Sub DataType()
            Dim client = New EasyDAClient()
            Dim serverDescriptor As ServerDescriptor = "OPCLabs.KitServer.2"

            ' Browse for all leaves under the "Simulation" branch
            Dim nodeElementCollection = client.BrowseLeaves(serverDescriptor, "Simulation")

            ' Create list of node descriptors, one for each leaf obtained
            ' filter out hint leafs that do not represent real OPC items (rare)
            Dim nodeDescriptorArray() As DANodeDescriptor = nodeElementCollection _
                .Where(Function(element) Not element.IsHint) _
                .Select(Function(element) New DANodeDescriptor(element)) _
                .ToArray()

            ' Get the value of DataType property; it is a 16-bit signed integer
            Dim valueResultArray() As ValueResult = client.GetMultiplePropertyValues(serverDescriptor,
                    nodeDescriptorArray, DAPropertyIds.DataType)

            For i = 0 To valueResultArray.Length - 1
                Dim nodeDescriptor = nodeDescriptorArray(i)

                ' Check if there has been an error getting the property value
                Dim valueResult As ValueResult = valueResultArray(i)
                If valueResult.Exception IsNot Nothing Then
                    Console.WriteLine("{0} *** Failure: {1}", nodeDescriptor.NodeId, valueResult.Exception.Message)
                    Continue For
                End If

                ' Convert the data type to VarType
                Dim varType = CType(CShort(valueResult.Value), VarType)

                ' Display the obtained data type
                Console.WriteLine("{0}: {1}", nodeDescriptor.ItemId, varType)
            Next i
        End Sub
    End Class
End Namespace

OPC XML-DA

Basic Example

// This example shows how to get value of multiple OPC XML-DA properties, and handle errors.
//
// Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
// case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
// IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
// code may also subscribe to the items in order to assure that they remain active.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

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

namespace DocExamples.DataAccess.Xml
{
    partial class GetMultiplePropertyValues
    {
        public static void Main1Xml()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            ServerDescriptor serverDescriptor = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";

            // Get the values of Timestamp and AccessRights properties of two items.
            ValueResult[] results = client.GetMultiplePropertyValues(new[]
            {
                new DAPropertyArguments(serverDescriptor, "Dynamic/Analog Types/Int", DAPropertyDescriptor.Timestamp),
                new DAPropertyArguments(serverDescriptor, "Dynamic/Analog Types/Int", DAPropertyDescriptor.AccessRights),
                new DAPropertyArguments(serverDescriptor, "Static/Analog Types/Double", DAPropertyDescriptor.Timestamp),
                new DAPropertyArguments(serverDescriptor, "Static/Analog Types/Double", DAPropertyDescriptor.AccessRights)
            });

            for (int i = 0; i < results.Length; i++)
            {
                ValueResult valueResult = results[i];
                if (valueResult.Exception is null)
                    Console.WriteLine($"results({i}).Value: {valueResult.Value}");
                else
                    Console.WriteLine($"results({i}).Exception.Message: {valueResult.Exception.Message}");
            }
        }
    }
}
# This example shows how to get value of multiple OPC XML-DA properties, and handle errors.

# Note that some properties may not have a useful value initially (e.g. until the item is activated in a group), which also the
# case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
# IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
# code may also subscribe to the items in order to assure that they remain active.
#
# 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 import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.OperationModel import *


# Instantiate the client object.
client = EasyDAClient()

serverDescriptor = ServerDescriptor('http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx')

# Get the values of Timestamp and AccessRights properties of two items.
results = client.GetMultiplePropertyValues(
    [
        DAPropertyArguments(serverDescriptor, DANodeDescriptor('Dynamic/Analog Types/Int'), DAPropertyDescriptor.Timestamp),
        DAPropertyArguments(serverDescriptor, DANodeDescriptor('Dynamic/Analog Types/Int'), DAPropertyDescriptor.AccessRights),
        DAPropertyArguments(serverDescriptor, DANodeDescriptor('Static/Analog Types/Double'), DAPropertyDescriptor.Timestamp),
        DAPropertyArguments(serverDescriptor, DANodeDescriptor('Static/Analog Types/Double'), DAPropertyDescriptor.AccessRights)
    ])

for i, valueResult in enumerate(results):
    if valueResult.Exception is None:
        print('results[', i, '].Value: ', valueResult.Value, sep='')
    else:
        print('results[', i, '].Exception.Message: ', valueResult.Exception.Message, sep='')
' This example shows how to get value of multiple OPC XML-DA properties, and handle errors.
'
' Note that some properties may not have a useful value initially (e.g. until the item Is activated in a group), which also the
' case with Timestamp property as implemented by the demo server. This behavior is server-dependent, and normal. You can run 
' IEasyDAClient.ReadMultipleItemValues.Main.vbs shortly before this example, in order to obtain better property values. Your 
' code may also subscribe to the items in order to assure that they remain active.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.OperationModel

Namespace DataAccess.Xml
    Partial Friend Class GetMultiplePropertyValues
        Shared Sub Main1Xml()
            ' Instantiate the client object.
            Dim client = New EasyDAClient()

            Dim serverDescriptor As ServerDescriptor = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx"

            ' Get the values of Timestamp and AccessRights properties of two items.
            Dim results() As ValueResult = client.GetMultiplePropertyValues(New DAPropertyArguments() {
                New DAPropertyArguments(serverDescriptor, "Dynamic/Analog Types/Int", DAPropertyDescriptor.Timestamp),
                New DAPropertyArguments(serverDescriptor, "Dynamic/Analog Types/Int", DAPropertyDescriptor.AccessRights),
                New DAPropertyArguments(serverDescriptor, "Static/Analog Types/Double", DAPropertyDescriptor.Timestamp),
                New DAPropertyArguments(serverDescriptor, "Static/Analog Types/Double", DAPropertyDescriptor.AccessRights)
             })

            For i = 0 To results.Length - 1
                Dim valueResult As ValueResult = results(i)
                If valueResult.Exception Is Nothing Then
                    Console.WriteLine($"results({i}).Value: {valueResult.Value}")
                Else
                    Console.WriteLine($"results({i}).Exception.Message: {valueResult.Exception.Message}")
                End If
            Next i

        End Sub

    End Class
End Namespace

Example combined with item browsing

The example below is a bit more complex, and combines the ability to browse for items with getting the the data type property for each of the items obtained, for OPC XML-DA Servers.

.NET

// This example shows how to obtain a data type of all OPC XML-DA items under a branch.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using System.Linq;
using OpcLabs.BaseLib.ComInterop;
using OpcLabs.BaseLib.OperationModel;
using OpcLabs.EasyOpc;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.AddressSpace;

namespace DocExamples.DataAccess.Xml
{
    partial class GetMultiplePropertyValues
    {
        public static void DataTypeXml()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            ServerDescriptor serverDescriptor = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";

            // Browse for all leaves under the "Static/Analog Types" branch
            DANodeElementCollection nodeElementCollection = client.BrowseLeaves(serverDescriptor, "Static/Analog Types");

            // Create list of node descriptors, one for each leaf obtained
            DANodeDescriptor[] nodeDescriptorArray = nodeElementCollection
                .Where(element => !element.IsHint)  // filter out hint leafs that do not represent real OPC items (rare)
                .Select(element => new DANodeDescriptor(element))
                .ToArray();

            // Get the value of DataType property; it is a 16-bit signed integer
            ValueResult[] valueResultArray = client.GetMultiplePropertyValues(serverDescriptor,
                nodeDescriptorArray, DAPropertyIds.DataType);

            for (int i = 0; i < valueResultArray.Length; i++)
            {
                DANodeDescriptor nodeDescriptor = nodeDescriptorArray[i];

                // Check if there has been an error getting the property value
                ValueResult valueResult = valueResultArray[i];
                if (!(valueResult.Exception is null))
                {
                    Console.WriteLine("{0} *** Failure: {1}", nodeDescriptor.NodeId, valueResult.Exception.Message);
                    continue;
                }

                // Convert the data type to VarType
                var varType = (VarType)(short)valueResult.Value;

                // Display the obtained data type
                Console.WriteLine("{0}: {1}", nodeDescriptor.ItemId, varType);
            }
        }
    }
}
# This example shows how to obtain a data type of all OPC XML-DA items under a branch.
#
# 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.BaseLib.ComInterop import *
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.DataAccess.OperationModel import *
from OpcLabs.EasyOpc.OperationModel import *


serverDescriptor = ServerDescriptor('http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx')

# Instantiate the client object.
client = EasyDAClient()

# Browse for all leaves under the "Static/Analog Types" branch
try:
    nodeElementCollection = IEasyDAClientExtension.BrowseLeaves(client,
                                                                serverDescriptor,
                                                                DANodeDescriptor('Static/Analog Types'))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Create list of node descriptors, one for each leaf obtained.
filteredNodeElements = filter(lambda element: not element.IsHint, nodeElementCollection)
nodeDescriptorArray = list(map(lambda element: DANodeDescriptor(element), filteredNodeElements))

# Get the value of DataType property; it is a 16-bit signed integer.
resultArray = IEasyDAClientExtension.GetMultiplePropertyValues(client,
                                                               serverDescriptor,
                                                               nodeDescriptorArray,
                                                               DAPropertyDescriptor.FromInt64(DAPropertyIds.DataType))
# Display results
for i, valueResult in enumerate(resultArray):
    nodeDescriptor = nodeDescriptorArray[i]
    # Check if there has been an error getting the property value.
    if valueResult.Exception is  None:
        # Convert the data type to VarType.
        varType = VarType(valueResult.Value)
        # Display the obtained data type.
        print(nodeDescriptor.ItemId, ': ', varType, sep='')
    else:
        print(nodeDescriptor.ItemId, ' *** Failure: ', valueResult.Exception.Message)

print()
print('Finished')
' This example shows how to obtain a data type of all OPC XML-DA items under a branch.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.BaseLib.ComInterop
Imports OpcLabs.BaseLib.OperationModel
Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess

Namespace DataAccess.Xml
    Friend Class GetMultiplePropertyValues
        Public Shared Sub DataTypeXml()
            Dim client = New EasyDAClient()
            Dim serverDescriptor As ServerDescriptor = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx"

            ' Browse for all leaves under the "Simulation" branch
            Dim nodeElementCollection = client.BrowseLeaves(serverDescriptor, "Static/Analog Types")

            ' Create list of node descriptors, one for each leaf obtained
            ' filter out hint leafs that do not represent real OPC items (rare)
            Dim nodeDescriptorArray() As DANodeDescriptor = nodeElementCollection _
                .Where(Function(element) Not element.IsHint) _
                .Select(Function(element) New DANodeDescriptor(element)) _
                .ToArray()

            ' Get the value of DataType property; it is a 16-bit signed integer
            Dim valueResultArray() As ValueResult = client.GetMultiplePropertyValues(serverDescriptor,
                    nodeDescriptorArray, DAPropertyIds.DataType)

            For i = 0 To valueResultArray.Length - 1
                Dim nodeDescriptor = nodeDescriptorArray(i)

                ' Check if there has been an error getting the property value
                Dim valueResult As ValueResult = valueResultArray(i)
                If valueResult.Exception IsNot Nothing Then
                    Console.WriteLine("{0} *** Failure: {1}", nodeDescriptor.NodeId, valueResult.Exception.Message)
                    Continue For
                End If

                ' Convert the data type to VarType
                Dim varType = CType(CShort(valueResult.Value), VarType)

                ' Display the obtained data type
                Console.WriteLine("{0}: {1}", nodeDescriptor.ItemId, varType)
            Next i
        End Sub
    End Class
End Namespace

COM

// This example shows how to obtain a data type of all OPC XML-DA items under a branch.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure GetMultiplePropertyValues.DataTypeXml;
var
  Arguments: OleVariant;
  BrowseParameters: _DABrowseParameters;
  Client: OpcLabs_EasyOpcClassic_TLB._EasyDAClient;
  Count: Cardinal;
  Element: OleVariant;
  I: Cardinal;
  PropertyArguments: _DAPropertyArguments;
  ServerDescriptor: _ServerDescriptor;
  NodeDescriptor: _DANodeDescriptor;
//  NodeDescriptorArray: Array of DANodeDescriptor;
  NodeElement: _DANodeElement;
  NodeElementCollection: _DANodeElementCollection;
  NodeElementEnumerator: IEnumVariant;
  ValueResult: _ValueResult;
  ValueResultArray: OleVariant;
  VarType: _VarType;
begin
  ServerDescriptor := CoServerDescriptor.Create;
  ServerDescriptor.UrlString := 'http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx';

  NodeDescriptor := CoDANodeDescriptor.Create;
  NodeDescriptor.ItemId := 'Static/Analog Types';

  BrowseParameters := CoDABrowseParameters.Create;
  BrowseParameters.BrowseFilter := DABrowseFilter_Leaves;

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

  // Browse for all leaves under the "Static/Analog Types" branch
  NodeElementCollection := Client.BrowseNodes(
      ServerDescriptor,
      NodeDescriptor,
      BrowseParameters);


  // Create list of node descriptors, one for aeach leaf obtained
  I := 0;
  Arguments := VarArrayCreate([0, NodeElementCollection.Count - 1], varVariant);
  NodeElementEnumerator := NodeElementCollection.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _DANodeElement;
    // filter out hint leafs that do not represent real OPC XML-DA items (rare)
    if Not NodeElement.IsHint then
    begin
      PropertyArguments := CoDAPropertyArguments.Create;
      PropertyArguments.ServerDescriptor := ServerDescriptor;
      PropertyArguments.NodeDescriptor := NodeElement.ToDANodeDescriptor;
      PropertyArguments.PropertyDescriptor.PropertyId.InternalValue := DAPropertyIds_DataType;
      Arguments[I] := PropertyArguments;
      I := I + 1;
    end;
  end;
//  SetLength(Arguments, I);

  // Get the value of DataType property; it is a 16-bit signed integer
  TVarData(ValueResultArray).VType := varArray or varVariant;
  TVarData(ValueResultArray).VArray := PVarArray(
    Client.GetMultiplePropertyValues(Arguments));

  // Display results
  for I := VarArrayLowBound(ValueResultArray, 1) to VarArrayHighBound(ValueResultArray, 1) do
  begin
      ValueResult := IInterface(ValueResultArray[I]) as _ValueResult;

      // Check if there has been an error getting the property value
      if ValueResult.Exception <> nil then
      begin
        WriteLn(Format('s *** Failures', [Arguments[I].NodeDescriptor.NodeId, ValueResult.Exception.Message]));
        Continue;
      end;

      // Convert the data type to VarType
      VarType := CoVarType.Create;
      VarType.InternalValue := ValueResult.Value;

      // Display the obtained data type
      WriteLn(Format(' s', [Arguments[I].NodeDescriptor.NodeId, VarType.ToString]));
  end;
  VarClear(ValueResultArray);
  VarClear(Arguments);
end;
// This example shows how to obtain a data type of all OPC XML-DA items under a branch.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

const DABrowseFilter_Leaves = 3;
const DAPropertyIds_DataType = 1;

$ServerDescriptor = new COM("OpcLabs.EasyOpc.ServerDescriptor");
$ServerDescriptor->UrlString = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx";

$NodeDescriptor = new COM("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor");
$NodeDescriptor->ItemID = "Static/Analog Types";

$BrowseParameters = new COM("OpcLabs.EasyOpc.DataAccess.DABrowseParameters");
$BrowseParameters->BrowseFilter = DABrowseFilter_Leaves;

$Client = new COM("OpcLabs.EasyOpc.DataAccess.EasyDAClient");

// Browse for all leaves under the "Static/Analog Types" branch
$NodeElementCollection = $Client->BrowseNodes($ServerDescriptor, $NodeDescriptor, $BrowseParameters)->ToList();

$PropertyArgumentArray = array();
for ($i = 0; $i < $NodeElementCollection->Count(); $i++)
{
    if (!($NodeElementCollection[$i]->IsHint)) // filter out hint leafs that do not represent real OPC items (rare)
    {
        $PropertyArguments = new COM("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments");
        $PropertyArguments->ServerDescriptor = $ServerDescriptor;
        $PropertyArguments->NodeDescriptor = $NodeElementCollection[$i]->ToDANodeDescriptor();
        $PropertyArguments->PropertyDescriptor->PropertyId->InternalValue = DAPropertyIds_DataType;
        $PropertyArgumentArray[] = $PropertyArguments;
    }
}

// Get the value of DataType property; it is a 16-bit signed integer
$valueResultArray = $Client->GetMultiplePropertyValues($PropertyArgumentArray);

for ($i = 0; $i < count($valueResultArray); $i++)
{
    // Check if there has been an error getting the property value
    $valueResult = $valueResultArray[$i];
    if (!is_null($valueResult->Exception))
    {
        printf("[s]: *** Failures\n", $PropertyArgumentArray[$i]->NodeDescriptor->NodeId, $valueResults->Exception->Message);
        continue;
    }
    // Convert the data type to VarType
    $VarType = new COM("OpcLabs.BaseLib.ComInterop.VarType");
    $VarType->InternalValue = $valueResult->Value;

    // Display the obtained data type
    printf("[s]s\n", $PropertyArgumentArray[$i]->NodeDescriptor->NodeId, $VarType);
}
Rem This example shows how to obtain a data type of all OPC XML-DA items under a branch.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Private Sub GetMultiplePropertyValues_DataTypeXml_Command_Click()
    OutputText = ""
    
    Dim serverDescriptor As New serverDescriptor
    serverDescriptor.UrlString = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx"

    Dim NodeDescriptor As New DANodeDescriptor
    NodeDescriptor.ItemId = "Static/Analog Types"
    
    Dim BrowseParameters As New DABrowseParameters
    BrowseParameters.BrowseFilter = DABrowseFilter_Leaves
    
    ' Instantiate the client object
    Dim client As New EasyDAClient

    ' Browse for all leaves under the "Static/Analog Types" branch
    Dim NodeElementCollection As DANodeElementCollection
    Set NodeElementCollection = client.BrowseNodes(serverDescriptor, NodeDescriptor, BrowseParameters)
    
    ' Create list of node descriptors, one for each leaf obtained
    Dim arguments()
    ReDim arguments(NodeElementCollection.Count)
    Dim i: i = 0
    Dim NodeElement: For Each NodeElement In NodeElementCollection
        ' filter out hint leafs that do not represent real OPC XML-DA items (rare)
        If Not NodeElement.IsHint Then
            Dim PropertyArguments As New DAPropertyArguments
            Set PropertyArguments.serverDescriptor = serverDescriptor
            Set PropertyArguments.NodeDescriptor = NodeElement.ToDANodeDescriptor
            PropertyArguments.PropertyDescriptor.PropertyId.NumericalValue = DAPropertyIds_DataType
            Set arguments(i) = PropertyArguments
            Set PropertyArguments = Nothing
            i = i + 1
        End If
    Next

    Dim propertyArgumentArray()
    ReDim propertyArgumentArray(i - 1)
    Dim j: For j = 0 To i - 1
        Set propertyArgumentArray(j) = arguments(j)
    Next

    ' Get the value of DataType property; it is a 16-bit signed integer
    Dim valueResultArray() As Variant
    valueResultArray = client.GetMultiplePropertyValues(propertyArgumentArray)

    ' Display results
    For j = 0 To i - 1
        Dim NodeDescriptor2 As DANodeDescriptor
        Set NodeDescriptor2 = propertyArgumentArray(j).NodeDescriptor
                
        Dim ValueResult As ValueResult: Set ValueResult = valueResultArray(j)
        ' Check if there has been an error getting the property value
        If Not ValueResult.Exception Is Nothing Then
            OutputText = OutputText & NodeDescriptor2.NodeId & " *** Failure: " & ValueResult.Exception.Message & vbCrLf
        Else
          ' Display the obtained data type
          Dim VarType As New VarType
          VarType.InternalValue = ValueResult.value
          OutputText = OutputText & NodeDescriptor2.NodeId & ": " & VarType & vbCrLf
        End If
    Next
End Sub
Rem This example shows how to obtain a data type of all OPC XML-DA items under a branch.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

Const DABrowseFilter_Leaves = 3
Const DAPropertyIds_DataType = 1

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.UrlString = "http://opcxml.demo-this.com/XmlDaSampleServer/Service.asmx"

Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor")
NodeDescriptor.ItemID = "Static/Analog Types"

Dim BrowseParameters: Set BrowseParameters = CreateObject("OpcLabs.EasyOpc.DataAccess.DABrowseParameters")
BrowseParameters.BrowseFilter = DABrowseFilter_Leaves

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")

' Browse for all leaves under the "Static/Analog Types" branch
Dim NodeElementCollection: Set NodeElementCollection = client.BrowseNodes(serverDescriptor, nodeDescriptor, browseParameters)

' Create list of node descriptors, one for each leaf obtained
Dim arguments()
Redim arguments(nodeElementCollection.Count)
Dim i: i = 0
Dim NodeElement: For Each NodeElement In NodeElementCollection
    ' filter out hint leafs that do not represent real OPC XML-DA items (rare)
    If Not NodeElement.IsHint Then
    Dim PropertyArguments: Set PropertyArguments = CreateObject("OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments")
    PropertyArguments.ServerDescriptor = ServerDescriptor
    PropertyArguments.NodeDescriptor = NodeElement.ToDANodeDescriptor
        PropertyArguments.PropertyDescriptor.PropertyId.InternalValue = DAPropertyIds_DataType
    Set arguments(i) = PropertyArguments
    i = i + 1
    End If    
Next

Dim propertyArgumentArray()
ReDim propertyArgumentArray(i - 1)
Dim j: For j = 0 To i - 1
    Set propertyArgumentArray(j) = arguments(j)
Next

' Get the value of DataType property; it is a 16-bit signed integer
Dim valueResultArray: valueResultArray = client.GetMultiplePropertyValues(propertyArgumentArray)

For j = 0 To i - 1
    Dim NodeDescriptor2: Set NodeDescriptor2 = propertyArgumentArray(j).NodeDescriptor
    ' Check if there has been an error getting the property value
    If Not (valueResultArray(j).Exception Is Nothing) Then
        WScript.Echo NodeDescriptor2.NodeId & " *** Failure: " & valueResultArray(j).Exception.Message
    Else
        ' Display the obtained data type
        Dim VarType: Set VarType = CreateObject("OpcLabs.BaseLib.ComInterop.VarType")
        VarType.InternalValue = valueResultArray(j).Value
        WScript.Echo nodeDescriptor2.NodeId & ": " & VarType
    End If
Next

 

QuickOPC supports OPC XML-DA also on Linux and macOS.

 

Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.BaseLib.OperationModel.OperationArguments
            OpcLabs.EasyOpc.DataAccess.OperationModel.DAPropertyArguments

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