Expand Minimize

NetUseDel function

The NetUseDel function ends a connection to a shared resource.

You can also use the WNetCancelConnection2 function to terminate a network connection.

Syntax


NET_API_STATUS NetUseDel(
  _In_  LMSTR UncServerName,
  _In_  LMSTR UseName,
  _In_  DWORD ForceCond
);

Parameters

UncServerName [in]

The UNC name of the computer on which to execute this function. If this is parameter is NULL, then the local computer is used.

If the UncServerName parameter specified is a remote computer, then the remote computer must support remote RPC calls using the legacy Remote Access Protocol mechanism.

This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.

UseName [in]

A pointer to a string that specifies the path of the connection to delete.

This string is Unicode if _WIN32_WINNT or FORCE_UNICODE are defined.

ForceCond [in]

The level of force to use in deleting the connection.

This parameter can be one of the following values defined in the lmuseflg.h header file.

ValueMeaning
USE_NOFORCE

Fail the disconnection if open files exist on the connection.

USE_FORCE

Do not fail the disconnection if open files exist on the connection.

USE_LOTS_OF_FORCE

Close any open files and delete the connection.

 

Return value

If the function succeeds, the return value is NERR_Success.

If the function fails, the return value is a system error code. For a list of error codes, see System Error Codes.

Remarks

The NetUseDel function applies only to the Server Message Block (LAN Manager Workstation) client. The NetUseDel function does not support Distributed File System (DFS) shares or other network file systems. To terminate a connection to a share using a different network provider (WebDAV or a DFS share, for example), use the WNetCancelConnection2 function.

No special group membership is required to call the NetUseDel function. This function cannot be executed on a remote server except in cases of downlevel compatibility.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Lmuse.h (include Lm.h)

Library

Netapi32.lib

DLL

Netapi32.dll

See also

NetUseAdd
Network Management Overview
Network Management Functions
Use Functions
WNetCancelConnection2

 

 

Community Additions

ADD
Show:
© 2014 Microsoft