DisconnectNetworkDrive method to discard the existing connection to a network resource.
aqFileSystem.DisconnectNetworkDrive(Name, Force, Remember)
|Force||[in]||Optional||Boolean||Default value: False|
|Remember||[in]||Optional||Boolean||Default value: True|
The method is applied to the following object:
The method has the following parameters:
Specifies the name of either the network resource you want to disconnect from, or the local device whose redirection you want to cancel.
If the connection you want to discard does not have a redirected device, specify the name of the network resource, for example, “\\Tester\WorkDirectory”. Otherwise, specify the name of the local device, for example, “Z:”. Note that the parameter's value can also contain values in any of the following formats: IPv4 address (for example, "\\192.168.1.1\share") and IPv6 address (for example, "\\2001-4898-9-3-c069-aa97-fe76-2449.ipv6-literal.net\share").
Specifies whether the connection should be canceled if there are opened files or transactions on the connection. If Force is False, which is the default value, and there are opened files or transactions, the method fails to disconnect form the network resource.
Specifies whether TestComplete will establish a connection to the specified network drive automatically next time you log in to the system under the current user account.
If the connection is canceled successfully, the method returns zero. Otherwise, it returns an error code. To get a description that corresponds to the given error code, you can use the
aqUtils.SysErrorMessage method. The complete list of error codes is provided in the System Error Codes article in the MSDN library.
The following code snippet cancels connection to the \\Tester\WorkDirectory network folder that does not have any redirected local device specified.
The following code snippet cancels connection to the network folder redirected to the “Z:” local device.