QuickOPC User's Guide and Reference
BrowseAccessPaths Method (IEasyDAClient)
Example 



OpcLabs.EasyOpcClassicCore Assembly > OpcLabs.EasyOpc.DataAccess Namespace > IEasyDAClient Interface : BrowseAccessPaths Method
The OPC server involved in the operation.
Descriptor of the node for which the access paths will be browsed.
Browses the possible access paths of a specified OPC item. Specify server descriptor, and node descriptor.
Syntax
'Declaration
 
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Function BrowseAccessPaths( _
   ByVal serverDescriptor As ServerDescriptor, _
   ByVal nodeDescriptor As DANodeDescriptor _
) As String()
'Usage
 
Dim instance As IEasyDAClient
Dim serverDescriptor As ServerDescriptor
Dim nodeDescriptor As DANodeDescriptor
Dim value() As String
 
value = instance.BrowseAccessPaths(serverDescriptor, nodeDescriptor)
[ElementsNotNull()]
[NotNull()]
string[] BrowseAccessPaths( 
   ServerDescriptor serverDescriptor,
   DANodeDescriptor nodeDescriptor
)
[ElementsNotNull()]
[NotNull()]
array<String^>^ BrowseAccessPaths( 
   ServerDescriptor^ serverDescriptor,
   DANodeDescriptor^ nodeDescriptor
) 

Parameters

serverDescriptor
The OPC server involved in the operation.
nodeDescriptor
Descriptor of the node for which the access paths will be browsed.

Return Value

The method returns an array of possible access paths to the item. You can use the returned access path e.g. as the AccessPath property of DAItemDescriptor object.
Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

The OPC "Classic" (or OPC XML-DA) operation has failed. This operation exception in uniformly used to allow common handling of various kinds of errors. The System.Exception.InnerException always contains information about the actual error cause.

This is an operation error that depends on factors external to your program, and thus cannot be always avoided. Your code must handle it appropriately.

Remarks

Most OPC servers do not use access paths.

Using implicit conversions, you can pass an item ID in place of node descriptor.

Example

.NET

COM

// This example shows how to obtain all access paths available for an item.

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

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

            for (int i = 0; i < accessPaths.Length; i++)
                Console.WriteLine($"accessPaths({i}): {accessPaths[i]}");
        }


        // Example output:
        //
        //accessPaths(0): Self
        //accessPaths(1): Other
    }
}
# This example shows how to obtain all access paths available for an item.

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

# Display results
for (i, accessPath) in enumerate(accessPaths):
    print('accessPaths[', i, ']: ', accessPath, sep='')
Rem This example shows how to obtain all access paths available for an item.

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 Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Dim accessPaths: accessPaths = Client.BrowseAccessPaths(ServerDescriptor, NodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim i: For i = LBound(accessPaths) To UBound(accessPaths)
    WScript.Echo "accessPaths(" & i & "): " & accessPaths(i)
Next
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