473,513 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

return sharename using System.IO?

KSC
Hello,

I have been looking through the docs on System.IO and cannot find a way to
return a share name on a mapped drive.

I have done this using FileSystemObject.Drive.ShareName, but I don't want to
have to reference the Scripting.dll just to get a drive's sharename while
using System.IO for everything else.

Thanks in advance. I appreciate your help.
Nov 21 '05 #1
9 1605
I have used a combination of API's WNetGetUniversalName and
NetShareEnum.
WNetGetUniversalName gives you the mapped drives, NetShareEnum gives you
the
local shared drives. By checking both of these you can establish the UNC
name of a folder or file.

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:KS*@discussions.microsoft.com:
Hello,

I have been looking through the docs on System.IO and cannot find a way to

return a share name on a mapped drive.

I have done this using FileSystemObject.Drive.ShareName, but I don't want
to
have to reference the Scripting.dll just to get a drive's sharename while

using System.IO for everything else.

Thanks in advance. I appreciate your help.


Nov 21 '05 #2
Scorpion,

I did not want to give you two times in a row a compliment.

I was writting that as well about this one.

This has been often as question in the newsgroup and I saw not a real answer
before I saw yours about those API's.

I don't need it, however next time a sample will help probably a lot of
people and gives me a reference to point too

Cor
Nov 21 '05 #3
Scorpion = Kelly
Nov 21 '05 #4
OK let me work on it.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:no************@planet.nl:
Scorpion,

I did not want to give you two times in a row a compliment.

I was writting that as well about this one.

This has been often as question in the newsgroup and I saw not a real
answer
before I saw yours about those API's.

I don't need it, however next time a sample will help probably a lot of
people and gives me a reference to point too

Cor


Nov 21 '05 #5
?!?

"Cor Ligthert" <no************@planet.nl> wrote in message
news:no************@planet.nl:
Scorpion = Kelly


Nov 21 '05 #6
Kelly,

I started this with Scorpion and that I found not nice while I usaly use
Kelly for that.

That Scorpion = Kelly was for you not in general.

That is all

Cor
Nov 21 '05 #7
KSC
After some more digging based on your answer I found an example for VB here:

http://support.microsoft.com/default...b;en-us;192689

Thanks for your help.

"scorpion53061" wrote:
I have used a combination of API's WNetGetUniversalName and
NetShareEnum.
WNetGetUniversalName gives you the mapped drives, NetShareEnum gives you
the
local shared drives. By checking both of these you can establish the UNC
name of a folder or file.

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:KS*@discussions.microsoft.com:
Hello,

I have been looking through the docs on System.IO and cannot find a way to

return a share name on a mapped drive.

I have done this using FileSystemObject.Drive.ShareName, but I don't want
to
have to reference the Scripting.dll just to get a drive's sharename while

using System.IO for everything else.

Thanks in advance. I appreciate your help.


Nov 21 '05 #8
KSC,

Thanks

Cor
Nov 21 '05 #9
Excellent work KSC.

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:KS*@discussions.microsoft.com:
After some more digging based on your answer I found an example for VB
here:

http://support.microsoft.com/default...b;en-us;192689

Thanks for your help.

"scorpion53061" wrote:
I have used a combination of API's WNetGetUniversalName and
NetShareEnum.
WNetGetUniversalName gives you the mapped drives, NetShareEnum gives you

the
local shared drives. By checking both of these you can establish the UNC

name of a folder or file.

"KSC" <KS*@discussions.microsoft.com> wrote in message
news:KS*@discussions.microsoft.com:
Hello,

I have been looking through the docs on System.IO and cannot find a
way to

return a share name on a mapped drive.

I have done this using FileSystemObject.Drive.ShareName, but I don't
want
to
have to reference the Scripting.dll just to get a drive's sharename
while

using System.IO for everything else.

Thanks in advance. I appreciate your help.



Nov 21 '05 #10

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

Similar topics

4
5444
by: surindersaini | last post by:
Hi I am not sure if we can do it and if can, then how. I have a class with a property that return object as its return type. when i am trying to Serialize the class it gives me error ...
9
2396
by: WithPit | last post by:
I am trying to create an Managed C++ Wrapper around an unmanaged library which contains C++ code. Some of the unmanaged methods returns an returntype which is of the abstract base type (for...
3
8961
by: Adam Froio | last post by:
Hi, Is there a way to look up a mapped drive letter's share name using VB.NET? I'd like to get \\server\share from O:\ I'm pretty sure it can be done by looking it up in the registry or...
9
3184
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
1
2840
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive...
3
14987
by: BombDrop | last post by:
Can any one help I have a method that will return a List to be bound as a datasource to a combobox see code for population below. I get the following error when i try to compile Error 29 ...
1
1666
by: hailua | last post by:
using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Collections; public partial class UserDefinedFunctions...
2
1189
by: =?Utf-8?B?ViZC?= | last post by:
Lately we get the problem on our server that it cannot reach the backupserver by \\servename\sharename, but when we use \\IP-adress\sharename it is no prblem. When we ping the backupserver we get...
2
2124
by: jmprescott | last post by:
I'm writing a program to get a MD5 hash from web page data. The hash part is working fine, but I'm having troubles getting the web page data. I threw up a couple messageboxes and I'm getting a null...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
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,...
1
7098
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...
0
7523
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...
1
5085
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...
0
4745
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...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
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 ...

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.