473,597 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drive Mapping

Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would use
to accomplish this?

Thanks in advance.

Sample code is appreciated.
Nov 15 '05 #1
3 1612
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET framework.
But if you really get down to bottom of it, there is no class or method in
..NET framework that accomplishes this task. This is the time when we take
help from PInvoke to call unmanaged Win32 API. The NetApi in Win32 platform
provides a rich set of functions that allows us to do network management.

--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@ho tmail.com> schreef in bericht
news:uU******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would use to accomplish this?

Thanks in advance.

Sample code is appreciated.

Nov 15 '05 #2
Jan,

No, this the time you take a look at the System.Manageme nt classes :-).

Willy.

"Jan Tielens" <ja*@no.spam.pl ease.leadit.be> wrote in message
news:eQ******** ******@TK2MSFTN GP10.phx.gbl...
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET framework. But if you really get down to bottom of it, there is no class or method in
.NET framework that accomplishes this task. This is the time when we take
help from PInvoke to call unmanaged Win32 API. The NetApi in Win32 platform provides a rich set of functions that allows us to do network management.

--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@ho tmail.com> schreef in bericht
news:uU******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not,
want to connect it. Anyone familiar with the .net classes that I would

use
to accomplish this?

Thanks in advance.

Sample code is appreciated.


Nov 15 '05 #3
Hi Willy

Do you have a small code snippet how you can do this? Because I'm not aware
how this can be done using the System.Manageme nt namespace. I agree it would
be (a lot) nicer than using PInvoke. Thx!

--
Greetz

Jan Tielens
_______________ _______________ __
Read my weblog: http://weblogs.asp.net/jan
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:#a******** ******@TK2MSFTN GP10.phx.gbl...
Jan,

No, this the time you take a look at the System.Manageme nt classes :-).

Willy.

"Jan Tielens" <ja*@no.spam.pl ease.leadit.be> wrote in message
news:eQ******** ******@TK2MSFTN GP10.phx.gbl...
This is an article covering your problem, with source code and examples:
http://www.codeproject.com/dotnet/pinvokeaddshare.asp
Title of this article says how to create a file share using .NET

framework.
But if you really get down to bottom of it, there is no class or method in .NET framework that accomplishes this task. This is the time when we take help from PInvoke to call unmanaged Win32 API. The NetApi in Win32

platform
provides a rich set of functions that allows us to do network management.
--
Greetz,
Jan
_______________ _______________ ____
Read my weblog: http://weblogs.asp.net/jan
"Chris Fink" <ch*********@ho tmail.com> schreef in bericht
news:uU******** ******@TK2MSFTN GP12.phx.gbl...
Hi,

Attempting to determine if a drive mapping is present, and if it is not, want to connect it. Anyone familiar with the .net classes that I
would use
to accomplish this?

Thanks in advance.

Sample code is appreciated.



Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1234
by: Vladimir | last post by:
How I can get the information about mapping path of the substituted drive from C# code. For example I have created the substitution using the command: C:\>subst r: "C:\Program Files" C:\>subst R:\: => C:\Program Files I wan to know from my .net application about the R: drive mapping. Thanks
2
5786
by: giloosh99 | last post by:
Hello, Im grabbing tables via VB code using visual foxpro ODBC drives. The tables directory is in a mapped network drive. The code works fine and does the job, however if the computer is idle for a while the network drive apears to have a red X on the icon and the drive becomes disconnected. this seems to effect the VB code from grabbing the tables. I get an error saying the specific table cannot be found. If i manually open the mapped...
1
1710
by: Tim | last post by:
I need to be able to control drive mapping on a win2000 server with C#. I will need to be able to check for it's existence (think I figured this out) and most importantly create a mapping to a server when necessary. Thanks for any clues you can give me on where to start looking.
1
1291
by: skumar | last post by:
whenever a user log in in my web application, i am trying to Map a drive "V:/" to a network path which is unique to each user(but i have to map to drive V:/ only). As any number of users can login to the web app at a particular time , i do not know how to do this mapping in the web server I have to map "V:/" drive only because, the ultimate aim is to open a word document which is a mail merge document with reference to Merge data document...
3
1821
by: skumar | last post by:
I want to map a drive to my web server at run time when a user clicks a link in my web application Is there a namespace in VB.net to Map drives Or is there a Shell command which directly runs the command from the command prompt instead of running a EXE or a batch file Does anybody have a method or code for this in VB.net Please let me know
0
980
by: fndjoum | last post by:
When using Visual Studio 2005, I was able to read the text file if it's in my local c:\ drive ifstream myfile; myfile.open("C:\\test.txt"); --------------> this works on local drive if (!myfile) { cout << "Unable to open file"; exit(1); // terminate with error } myfile.close();
13
7063
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path with the mapped drive letter, but the drive letter refers to the drive mapping for the user that started the process, and cannot be resolved to a UNC path from a service running under LocalSystem. Presumably, therefore, I need to get the drive...
10
11002
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Sorry about that previous one. I pressed enter too early. How does one go about mapping a network drive in C#. i know you use MapNetworkDrive in scripting languages, but i'm not sure how to do it in C#. It doesnt seem like C$ would use MapNetworkDrive.
20
7074
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello, I'm trying to create an admin page that can run miscellaneous scripts for our IT department. Currently, I'm trying to create a script that can map a network drive for a user (e.g. a form where I can input \\path\folder, drive letter, and domain\user). Is this possible? If so, can someone point me in the right direction? Thank you, Brian Nicholson
5
3564
by: Phil | last post by:
A file used by my application may be stored on a shared network drive, so that it can be accessed by different people using the same application. I have written some code that uses an OpenFileDialog to allow the user to specify the location of the file (I then store the filename in the registry). This all works fine from when the application is run normally, but I would like to force the user to do this when the software is first...
0
7970
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8259
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6695
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5434
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3930
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2404
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.