OPC Studio User's Guide and Reference
GetCertificateSubjectName Method (_EasyUAClientServerApplication)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Application.ComTypes Namespace > _EasyUAClientServerApplication Interface : GetCertificateSubjectName Method

The value of this parameter can be null (Nothing in Visual Basic).

Gets the subject distinguished name the application is configured to use for its certificates.
Syntax
'Declaration
 
<NotNullAttribute()>
Function GetCertificateSubjectName( _
   ByVal certificateSubId As String _
) As String
'Usage
 
Dim instance As _EasyUAClientServerApplication
Dim certificateSubId As String
Dim value As String
 
value = instance.GetCertificateSubjectName(certificateSubId)
[NotNull()]
string GetCertificateSubjectName( 
   string certificateSubId
)
[NotNull()]
String^ GetCertificateSubjectName( 
   String^ certificateSubId
) 

Parameters

certificateSubId

The value of this parameter can be null (Nothing in Visual Basic).

Return Value

Returns the subject distinguished name.

This method never returns null (Nothing in Visual Basic).

Exceptions
ExceptionDescription
An error has occurred during application execution.

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.

Remarks

This member or type is for use from COM. It is not meant to be used from .NET or Python. Refer to the corresponding .NET member or type instead, if you are developing in .NET or Python.

This is an extension method (info: C#, VB.NET). In languages that have support for extensions methods (such as C# and VB.NET), you can use the extension method as if it were a regular method on the object that is its first parameter. In other languages (such as with Python.NET), you will call the extension as a static method, and pass it the object on which it acts as its first parameter.

Example
// Shows how to get the subject name of application certificates.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

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

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

            // Get the subject name of application certificates.
            string certificateSubjectName = application.GetCertificateSubjectName();

            // Display results
            Console.WriteLine("Certificate subject name: {0}", certificateSubjectName);
        }
    }
}
' Shows how to get the subject name of application certificates.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc.UA.Application
Imports OpcLabs.EasyOpc.UA.Application.Extensions

Namespace Application._IEasyUAClientServerApplication
    Friend Class GetCertificateSubjectName
        Public Shared Sub Main1()
            ' Obtain the application interface.
            Dim application As EasyUAApplication = EasyUAApplication.Instance

            ' Get the subject name of application certificates.
            Dim certificateSubjectName = application.GetCertificateSubjectName()

            ' Display results
            Console.WriteLine("Certificate subject name: {0}", certificateSubjectName)
        End Sub
    End Class
End Namespace
// Shows how to get the subject name of application certificates.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in Object Pascal (Delphi) on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-OP .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

class procedure GetCertificateSubjectName.Main;
var
  Application: TEasyUAApplication;
  CertificateSubjectName: string;
begin
  // Obtain the application interface.
  Application := TEasyUAApplication.Create(nil);

  // Get the subject name of application certificates.
  CertificateSubjectName := Application.GetCertificateSubjectName('');

  // Display results
  WriteLn('Certificate subject name: ', CertificateSubjectName);
end;
# Shows how to get the subject name of application certificates.
#
# 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 .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA.Application import *
from OpcLabs.EasyOpc.UA.Application.Extensions import *


# Obtain the application interface.
application = EasyUAApplication.Instance

# Get the subject name of application certificates.
certificateSubjectName = IEasyUAClientServerApplicationExtension.GetCertificateSubjectName(application)

# Display results.
print('Certificate subject name: ', certificateSubjectName, sep='')

print()
print('Finished.')
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