.. index:: 
  !DocumentLicense.activateActivationKey Method
  
.. _id3_document_document_license_activate_activation_key_class_method:

===============================================================================
DocumentLicense.activateActivationKey Method
===============================================================================

Module: :ref:`DocumentLicense<id3_document_document_license_class>`

Definition
----------

Activates a license file using an activation key and saves the license to a file.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        @staticmethod
        activate_activation_key(hardware_code: str, activation_key: str, commentary: str, path: str) -> None

      **Parameters**

        .. line-block::

          ``hardware_code`` str
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activation_key`` str
          :guilabel:`in` The activation key.

          ``commentary`` str
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` str
          :guilabel:`in` Path to the retrieved license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        static void activateActivationKey(String? hardwareCode, String? activationKey, String? commentary, String? path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the retrieved license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public static void ActivateActivationKey(string hardwareCode, string activationKey, string commentary, string path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` string
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` string
          :guilabel:`in` The activation key.

          ``commentary`` string
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` string
          :guilabel:`in` Path to the retrieved license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public static void activateActivationKey(String hardwareCode, String activationKey, String commentary, String path) throws DocumentException

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the retrieved license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public static func activateActivationKey(hardwareCode: String, activationKey: String, commentary: String, path: String) throws

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` String
          :guilabel:`in` The activation key.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the retrieved license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3DocumentLicense_ActivateActivationKey (
            const char * hardwareCode, 
            const char * activationKey, 
            const char * commentary, 
            const char * path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` const char *
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``activationKey`` const char *
          :guilabel:`in` The activation key.

          ``commentary`` const char *
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` const char *
          :guilabel:`in` Path to the retrieved license file.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


