OPC Studio User's Guide and Reference
GetApplicationElement Method (_EasyUAApplication)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Application.ComTypes Namespace > _EasyUAApplication Interface : GetApplicationElement Method
Gets the OPC UA registration information for this application.
Syntax
'Declaration
 
<NotNullAttribute()>
Function GetApplicationElement() As UAApplicationElement
 
'Usage
 
Dim instance As _EasyUAApplication
Dim value As UAApplicationElement
 
value = instance.GetApplicationElement()

Return Value

Returns the application element describing how the application is configured to register itself in OPC UA ecosystem.
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 UA 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.

Example

.NET

COM

// Shows how to get the OPC UA registration information for this application.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.EasyOpc.UA.Application;
using OpcLabs.EasyOpc.UA.Application.Extensions;
using OpcLabs.EasyOpc.UA.Discovery;

namespace UADocExamples.Application._IEasyUAClientServerApplication
{
    class GetApplicationElement
    {
        public static void Main1()
        {
            // Obtain the application interface.
            EasyUAApplication application = EasyUAApplication.Instance;

            // Get the OPC UA registration information for this application.
            UAApplicationElement applicationElement = application.GetApplicationElement();

            // Display results
            Console.WriteLine("Application element:");
            Console.WriteLine("  Application name: {0}", applicationElement.ApplicationName);
            Console.WriteLine("  Application type: {0}", applicationElement.ApplicationType);
            Console.WriteLine("  Application URI string: {0}", applicationElement.ApplicationUriString);
            Console.WriteLine("  Discovery URI strings: {0}", applicationElement.DiscoveryUriStrings);
            Console.WriteLine("  Product URI string: {0}", applicationElement.ProductUriString);
        }
    }
}
// Shows how to get the OPC UA registration information for this application.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure GetApplicationElement.Main;
var
  Application: TEasyUAApplication;
  ApplicationElement: _UAApplicationElement;
begin
  // Obtain the application interface.
  Application := TEasyUAApplication.Create(nil);

  // Get the OPC UA registration information for this application.
  ApplicationElement := Application.GetApplicationElement;

  // Display results
  WriteLn('Application element:');
  WriteLn('  Application name: ', ApplicationElement.ApplicationName);
  WriteLn('  Application type: ', ApplicationElement.ApplicationType);
  WriteLn('  Application URI string: ', ApplicationElement.ApplicationUriString);
  WriteLn('  Discovery URI string: ', ApplicationElement.DiscoveryUriString);
  WriteLn('  Product URI string: ', ApplicationElement.ProductUriString);
end;
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