# Hasp.Detach Method

NOTE This method is deprecated and has been replaced by the Transfer method.

Namespace: Aladdin.Hasp

## Description

Performs either of the following functions:

>Detaches a license for a Product from a Sentinel SL key (on the host machine), according to customizable parameters. Features defined as detachable and memory files that belong to the Product are detached.

>Cancels a detached license from the Sentinel SL key (on the recipient machine), typically before the detached license was due to expire.

You do not need to be logged in to a Feature in order to use this method.

## Syntax

    static HaspStatus Detach ( String detach_action,
                               String     scope,
                               Byte []    vendor_code,
                               String     recipient,
                               ref String info
                      )

## Parameters

`detach_action` | Detach | Detach operation parameters, in XML format. The following example specifies that a detached license for Product ID 12345 will expire after 604,800 seconds (one week): <detach> <product id=”12345”> <duration>604800</duration> </product> </detach>
Cancel | Cancel operation parameters, in XML format. The following example specifies that the Sentinel SL key with ID “12321” for the detached license should be cancelled: <cancel> <hasp id=”12321”/> </cancel>
`scope` | Search parameters for the Product that is to be detached. For more information, see Scope Input XML Tags.
`vendor_code` | Bytes that contain the Vendor Code
`recipient` | For Detach | Definition in XML format of the recipient machine to which the detached license will be attached. Use either the GetInfo or GetSessionInfo method, together with the HASP_RECIPIENT predefined format template, to retrieve the recipient information.
For Cancel | Ignored (set to Null).
`info` | Reference of the string that receives the output (in XML format). This information is a: >H2R file (for the Detach action), which can then be installed on the recipient machine >R2H file (for the Cancel action), which can then be installed on the host machine The file can be installed using the Update method (or using the Admin Control Center or RUS utility).

## Return Values

A HaspStatus status code.

## Usage Notes

The required Vendor Codes are stored in a VendorCodes folder in your system. Without the correct Vendor Code, the method call cannot succeed.

This method only works with Sentinel SL protection keys; Sentinel HL protection keys are ignored.

This method can also be used on the recipient machine to cancel an attached license. In this case, the recipient parameter is ignored and should be set to NULL. For a cancel operation, the method returns an R2H file. This file must be applied on the host machine using the Update method or using Sentinel Admin Control Center. If the detached Product has already expired, no R2H file is returned.

## Overloaded Methods

The following overloaded methods are provided. They differ from the method above only in the argument type that they accept.

    static HaspStatus Detach ( String     detach_action )
                               String     scope,
                               String     vendor_code,
                               String     recipient,
                               ref String info
                             )

## Related Topics

GetInfo Method

GetSessionInfo Method

Scope Input XML Tags

Format XML Tags

hasp_detach XML Tags