|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
UNC paths from drive mappingsI can get a list of drive mappings via
Directory.GetLogicalDrives but is there any way I can get the UNC path (eg. \\machine\sharename) for those drives that are mapped to network shares? Use the DriveInfo class:
foreach(DriveInfo drive in DriveInfo.GetDrives()){ Console.WriteLine(drive + " " + drive.DriveType); } DriveType will equal "Network" for mapped drives. Show quote "JezB" <j***@somewhere.com> wrote in message news:erYwkDLXHHA.4240@TK2MSFTNGP06.phx.gbl: > I can get a list of drive mappings via > > Directory.GetLogicalDrives > > but is there any way I can get the UNC path (eg. \\machine\sharename) for > those drives that are mapped to network shares? "JezB" <j***@somewhere.com> wrote in message
http://pinvoke.net/default.aspx/netapi32/NetUseEnum.html
news:erYwkDLXHHA.4240@TK2MSFTNGP06.phx.gbl... >I can get a list of drive mappings via > > Directory.GetLogicalDrives > > but is there any way I can get the UNC path (eg. \\machine\sharename) for > those drives that are mapped to network shares? I would avoid using p/invoke if you can, but I break this same rule when
I have to do so. Show quote "Ben Voigt" <rbv@nospam.nospam> wrote in message news:OiXXqw1XHHA.1216@TK2MSFTNGP03.phx.gbl: > "JezB" <j***@somewhere.com> wrote in message > news:erYwkDLXHHA.4240@TK2MSFTNGP06.phx.gbl... > >I can get a list of drive mappings via > > > > Directory.GetLogicalDrives > > > > but is there any way I can get the UNC path (eg. \\machine\sharename) for > > those drives that are mapped to network shares? > > http://pinvoke.net/default.aspx/netapi32/NetUseEnum.html |
|||||||||||||||||||||||