Click or drag to resize
HostConnectDrive Method (IntPtr, String, String, String, String, Boolean, Boolean, Boolean)
Creates a connection to a network resource. The function can redirect a local device to a network resource.

Namespace: Alphaleonis.Win32.Network
Assembly: AlphaFS (in AlphaFS.dll) Version: 2.0
public static string ConnectDrive(
	IntPtr winOwner,
	string localName,
	string remoteName,
	string userName,
	string password,
	bool prompt,
	bool updateProfile,
	bool saveCredentials


Type: SystemIntPtr
Handle to a window that the provider of network resources can use as an owner window for dialog boxes.
Type: SystemString
The name of a local device to be redirected, such as "F:". When localName is or string.Empty, the last available drive letter will be used. Letters are assigned beginning with Z:, then Y: and so on.
Type: SystemString
The network resource to connect to. The string can be up to MAX_PATH characters in length.
Type: SystemString
The user name for making the connection. If userName is , the function uses the default user name. (The user context for the process provides the default user name)
Type: SystemString
The password to be used for making the network connection. If password is , the function uses the current default password associated with the user specified by userName.
Type: SystemBoolean
always pop-ups an authentication dialog box.
Type: SystemBoolean
successful network resource connections will be saved.
Type: SystemBoolean
When the operating system prompts for a credential, the credential should be saved by the credential manager when true.

Return Value

Type: String
If localName is or string.Empty, returns the last available drive letter, null otherwise.
See Also