QuickOPC User's Guide and Reference
GetApplicationElement Method (IEasyUAApplicationExtension)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Application.Extensions Namespace > IEasyUAApplicationExtension Class : GetApplicationElement Method
Gets the OPC UA registration information for this application.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Shared Function GetApplicationElement( _
   ByVal application As IEasyUAApplication _
) As UAApplicationElement
'Usage
 
Dim application As IEasyUAApplication
Dim value As UAApplicationElement
 
value = IEasyUAApplicationExtension.GetApplicationElement(application)
[Extension()]
[NotNull()]
public static UAApplicationElement GetApplicationElement( 
   IEasyUAApplication application
)
[Extension()]
[NotNull()]
public:
static UAApplicationElement^ GetApplicationElement( 
   IEasyUAApplication^ application
) 

Parameters

application

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.
The OPC UA operation has failed.
Example
// Shows how to get the OPC UA registration information for this application.

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

namespace UADocExamples.Application._IEasyUAClientApplication
{
    class GetApplicationElement
    {
        public static void Main1()
        {
            // Obtain the client application service.
            var client = new EasyUAClient();
            IEasyUAClientApplication clientApplication = client.GetService<IEasyUAClientApplication>();

            // Get the OPC UA registration information for this application.
            UAApplicationElement applicationElement = clientApplication.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.

class procedure GetApplicationElement.Main;
var
  ApplicationElement: _UAApplicationElement;
  Client: _EasyUAClient;
  ClientApplication: _EasyUAClientApplication;
begin
  // Obtain the client application service.
  Client := CoEasyUAClient.Create;
  ClientApplication := IInterface(Client.GetServiceByName('OpcLabs.EasyOpc.UA.Application.IEasyUAClientApplication, OpcLabs.EasyOpcUA')) as _EasyUAClientApplication;

  // Get the OPC UA registration information for this application.
  ApplicationElement := ClientApplication.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;
' Shows how to get the OPC UA registration information for this application.

Imports Microsoft.Extensions.DependencyInjection
Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.Application
Imports OpcLabs.EasyOpc.UA.Application.Extensions

Namespace UADocExamples.Application._IEasyUAClientApplication
    Friend Class GetApplicationElement
        Public Shared Sub Main1()
            ' Obtain the client application service.
            Dim client = New EasyUAClient()
            Dim clientApplication = client.GetService(Of IEasyUAClientApplication)()

            ' Get the OPC UA registration information for this application.
            Dim applicationElement = clientApplication.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)
        End Sub
    End Class
End Namespace
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012 R2, Windows Server 2016; .NET Core, .NET 6: Linux, macOS, Microsoft Windows

See Also