QuickOPC User's Guide and Reference
DAPropertyElement Class
Members 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.DataAccess.AddressSpace Namespace : DAPropertyElement Class
Contains information gathered about an OPC property.
Object Model
DAPropertyElement ClassVarType ClassVarType ClassDAPropertyId ClassXmlQualifiedName2 ClassDAPropertyId ClassXmlQualifiedName2 Class
Syntax
'Declaration
 
<CLSCompliantAttribute(True)>
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement)>
<ComVisibleAttribute(True)>
<GuidAttribute("33FF8F12-EF7B-4C54-9467-579C6ABC3EB0")>
<TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class DAPropertyElement 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As DAPropertyElement
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement)]
[ComVisible(true)]
[Guid("33FF8F12-EF7B-4C54-9467-579C6ABC3EB0")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class DAPropertyElement : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[CLSCompliant(true)]
[ComDefaultInterface(OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement)]
[ComVisible(true)]
[Guid("33FF8F12-EF7B-4C54-9467-579C6ABC3EB0")]
[TypeConverter(System.ComponentModel.ExpandableObjectConverter)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.72.465.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class DAPropertyElement sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.DataAccess.AddressSpace.ComTypes._DAPropertyElement, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks
This object is filled in and returned e.g. when you browse the properties of an OPC item.

 

Each OPC item has typically associated a set of OPC properties with it. OPC properties contain additional information related to the item. The OPC specifications define a set of common properties; however, each OPC server is free to implement some more, vendor-specific properties as well.

If you want to retrieve a list of all properties available on a given OPC item, call the BrowseProperties method, passing it the ItemID you are interested in. You will receive back a DAPropertyElementCollection object. Each DAPropertyElement contains information about one OPC property, such as its (numeric) PropertyId, data type, or a readable description. The PropertyId can be later used as an argument in calling methods such as GetPropertyValue.

You can use DAPropertyId.GetName and GetPropertyType methods to obtain the string identifier of the property, or its type. With OPC XML, properties are identified by a XML qualified name, and you will find it in the DAPropertyElement.QualifiedName property.

Constants for specific (well-known) OPC properties are contained in the DAPropertyIds enumeration.

.NET

// This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

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

namespace DocExamples.DataAccess._EasyDAClient
{
    class BrowseProperties
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();
            DAPropertyElementCollection propertyElements;
            try
            {
                propertyElements = client.BrowseProperties("OPCLabs.KitServer.2", "Simulation.Random");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            foreach (DAPropertyElement propertyElement in propertyElements)
                Console.WriteLine($"PropertyElements(\"{propertyElement.PropertyId.NumericalValue}\").Description: {propertyElement.Description}");
        }


        // Example output:
        //
        //PropertyElements("15008").Description: Visible
        //PropertyElements("5").Description: Item Access Rights
        //PropertyElements("2").Description: Item Value
        //PropertyElements("7").Description: Item EU Type
        //PropertyElements("15001").Description: Item Name
        //PropertyElements("4").Description: Item Timestamp
        //PropertyElements("1").Description: Item Canonical Data Type
        //PropertyElements("103").Description: Low EU
        //PropertyElements("15009").Description: Addable
        //PropertyElements("6").Description: Server Scan Rate
        //PropertyElements("15000").Description: Item ID
        //PropertyElements("3").Description: Item Quality
    }
}
# This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.OperationModel
using namespace OpcLabs.EasyOpc.DataAccess

# 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

try {
    $propertyElements = $client.BrowseProperties("OPCLabs.KitServer.2", "Simulation.Random")
}
catch [OpcException] {
    Write-Host "*** Failure: $($PSItem.Exception.GetBaseException().Message)"
    return
}

Foreach ($propertyElement in $propertyElements) {
    Write-Host "PropertyElements(`"$($propertyElement.PropertyId.NumericalValue)`").Description: $($propertyElement.Description)"
}


# Example output:
#
#PropertyElements("15008").Description: Visible
#PropertyElements("5").Description: Item Access Rights
#PropertyElements("2").Description: Item Value
#PropertyElements("7").Description: Item EU Type
#PropertyElements("15001").Description: Item Name
#PropertyElements("4").Description: Item Timestamp
#PropertyElements("1").Description: Item Canonical Data Type
#PropertyElements("103").Description: Low EU
#PropertyElements("15009").Description: Addable
#PropertyElements("6").Description: Server Scan Rate
#PropertyElements("15000").Description: Item ID
#PropertyElements("3").Description: Item Quality

# This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and
# description.

# 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:
    propertyElements = IEasyDAClientExtension.BrowseProperties(client, '', 'OPCLabs.KitServer.2', 'Simulation.Random')
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results.
for propertyElement in propertyElements:
    print('PropertyElements[', propertyElement.PropertyId.NumericalValue, '].Description: ', propertyElement.Description,
          sep='')

COM

// This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

class procedure BrowseProperties.Main;
var
  Client: OpcLabs_EasyOpcClassic_TLB._EasyDAClient;
  Count: Cardinal;
  Element: OleVariant;
  ServerDescriptor: _ServerDescriptor;
  NodeDescriptor: _DANodeDescriptor;
  PropertyElement: _DAPropertyElement;
  PropertyElementEnumerator: IEnumVariant;
  PropertyElements: _DAPropertyElementCollection;
begin
  ServerDescriptor := CoServerDescriptor.Create;
  ServerDescriptor.ServerClass := 'OPCLabs.KitServer.2';

  NodeDescriptor := CoDANodeDescriptor.Create;
  NodeDescriptor.ItemId := 'Simulation.Random';

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

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

  PropertyElementEnumerator := PropertyElements.GetEnumerator;
  while (PropertyElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    PropertyElement := IUnknown(Element) as _DAPropertyElement;
    WriteLn('PropertyElements("', PropertyElement.PropertyId.NumericalValue, '").Description: ', PropertyElement.Description);
  end;
end;
// This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

$ServerDescriptor = new COM("OpcLabs.EasyOpc.ServerDescriptor");
$ServerDescriptor->ServerClass = "OPCLabs.KitServer.2";

$NodeDescriptor = new COM("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor");
$NodeDescriptor->ItemID = "Simulation.Random";

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

try
{
    $PropertyElements = $Client->BrowseProperties($ServerDescriptor, $NodeDescriptor);
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    Exit();
}

foreach ($PropertyElements as $PropertyElement)
{
    printf("PropertyElements(\"s\").Descriptions\n", $PropertyElement->PropertyID->NumericalValue, $PropertyElement->Description);
}
Rem This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

Private Sub BrowseProperties_Main_Command_Click()
    OutputText = ""
    
    Dim serverDescriptor As New serverDescriptor
    serverDescriptor.ServerClass = "OPCLabs.KitServer.2"
    
    Dim nodeDescriptor As New DANodeDescriptor
    nodeDescriptor.itemId = "Simulation.Random"
    
    ' Instantiate the client object
    Dim client As New EasyDAClient

    On Error Resume Next
    Dim propertyElements As DAPropertyElementCollection
    Set propertyElements = client.BrowseProperties(serverDescriptor, nodeDescriptor)
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    Dim propertyElement: For Each propertyElement In propertyElements
        OutputText = OutputText & "propertyElements(""" & propertyElement.propertyId.NumericalValue & """).Description: " & propertyElement.Description & vbCrLf
    Next
End Sub
Rem This example shows how to enumerate all properties of an OPC item. For each property, it displays its Id and description.

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.Random"

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

Dim PropertyElement: For Each PropertyElement In PropertyElements
    WScript.Echo "PropertyElements(""" & PropertyElement.PropertyID.NumericalValue & """).Description: " & PropertyElement.Description
Next

 

 

 

Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.DataAccess.AddressSpace.DAPropertyElement

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