netusedel (netapi32)
Last changed: anonymous

.
Summary
The NetUseDel function ends a connection to a shared resource.

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

C# Signature:

  const UInt32 USE_NOFORCE = 0;
  const UInt32 USE_FORCE = 1;
  const UInt32 USE_LOTS_OF_FORCE = 2;

  [DllImport("NetApi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
  private static extern UInt32 NetUseDel(
      string UncServerName,
      string UseName,
      UInt32 ForceCond
  );

VB Signature:

Declare Function NetUseDel Lib "netapi32.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

  var returnCode = NetUseDel(null, @"\\server\c$", USE_NOFORCE);
  if (returnCode != 0)
  {
      throw new Win32Exception((int)returnCode);
  }

Documentation
NetUseDel on MSDN