Monday, April 26, 2004

Map Network Drive (API)

The Code Project - Map Network Drive (API) - C# Programming

"Introduction
This is a class for interfacing with windows map network drive API's.

Using the code
Add the class file "cNetworkDrives0010.cs" to your project / solution.
Add the "using" definition to your form, etc.

using aejw.Network;

Then declare and use the class.
//Example: Map Drive M
cNetworkDrive oNetwork = new cNetworkDrive();
oNetwork.MapNetworkDrive("\\Computer\Share1","M:");
oNetwork.MapNetworkDrive("\\Computer\Share2","N:","BobPass");
oNetwork.MapNetworkDrive("\\Computer\Share","O:","Bob","BobPass");
..."

I was looking for something like this the other day...

1 comment:

  1. I'm having some problems when trying to use this code running as a service, because when you are logged in using the LocalSystem account you can't map.

    ReplyDelete

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...