NetShareDel (netapi32)
Last changed: baalexander-65.216.122.126

.
Summary
Deletes a network share on either a local or remote machine

C# Signature:

[DllImport("Netapi32.dll")]
public static extern int NetShareDel(
        [MarshalAs(UnmanagedType.LPWStr)]
        string strServer,
        [MarshalAs(UnmanagedType.LPWStr)]
        string netName, Int32 reserved);

VB Signature:

Declare Unicode Function NetShareDel Lib "netapi32.dll" _
            (ByVal ServerName As String, _
            ByVal NetName As String, _
            ByVal Reserved As Integer) As Integer

User-Defined Types:

None.

Notes:

[2004-06-11]
VB Def and Sample code added by RACKLEY

Tips & Tricks:

Specify null instead serverName to indicate local machine.

Sample Code:

' This one is easy!
retval = NetShareDel(ServerName, "MyShareName", 0)

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
NetShareDel on MSDN