Abstractions.WindowsApi.pInvokes.DisconnectNetworkDrive C# (CSharp) Method

DisconnectNetworkDrive() public static method

disconnecting an UNC share
public static DisconnectNetworkDrive ( string remoteUNC ) : System.Boolean
remoteUNC string
return System.Boolean
        public static Boolean DisconnectNetworkDrive(string remoteUNC)
        {
            int ret = SafeNativeMethods.WNetCancelConnection2(remoteUNC, SafeNativeMethods.Connect.CONNECT_UPDATE_PROFILE, false);
            if ((ret != 0) && (ret != 2250/*This network connection does not exist*/))
            {
                LibraryLogging.Error("Unable to disConnect from {0} Error:{1} {2}", remoteUNC, ret, LastError());
                return false;
            }

            return true;
        }