 |
|
|
|
| Author |
Message |
Charles Teel
Joined: 31 Jan 2008 Posts: 4
|
Posted: Thu Jan 31, 2008 2:31 pm Post subject: DirectoryInfo and Network Shares |
|
|
I'm working on an app that will display a list of shared resources on
a PC connected to the TCP/IP network. I figured out how to get the
list of the shared folders and printers on a PC, but I can't figure
out how to differentiate between the two.
I'm using the DirectoryInfo.GetDirectories() method to get the list of
shared items (which returns the array of DirectoryInfo objects for the
shared items on the specified PC).
Any ideas?
Thanks in advance
Archived from group: microsoft>public>dotnet>framework>compactframework |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Thu Jan 31, 2008 3:53 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
Is this really a *Compact* Framework question? It sounds like you're
talking about desktop Windows. This group is about Windows CE/Windows
Mobile, *not* Windows XP/Windows Vista .NET...
Paul T.
"Charles Teel" wrote in message @e6g2000prf.googlegroups.com...
> I'm working on an app that will display a list of shared resources on
> a PC connected to the TCP/IP network. I figured out how to get the
> list of the shared folders and printers on a PC, but I can't figure
> out how to differentiate between the two.
>
> I'm using the DirectoryInfo.GetDirectories() method to get the list of
> shared items (which returns the array of DirectoryInfo objects for the
> shared items on the specified PC).
>
> Any ideas?
>
> Thanks in advance |
|
| Back to top |
|
 |
Charles Teel
Joined: 31 Jan 2008 Posts: 4
|
Posted: Thu Jan 31, 2008 3:31 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
On Jan 31, 11:53 am, "Paul G. Tobey [eMVP]"
no instrument no spam DOT com> wrote:
> Is this really a *Compact* Framework question? It sounds like you're
> talking about desktop Windows. This group is about Windows CE/Windows
> Mobile, *not* Windows XP/Windows Vista .NET...
>
> Paul T.
Yes, this is a Compact Framework question, because the app is on a
Windows Mobile Device. Now, the PC that has the file and printer
shares is going to be a WinXP/Vista machine. But the code I'm writing
is on the mobile device. |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Thu Jan 31, 2008 5:06 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
OK. So you have a list of resources and the problem is to identify which
are printers and which are folders, yes? The underlying API for enumeration
of network resources is WNetEnumResource(). The structure returned by that
call includes a 'type' field which indicates either RESOURCETYPE_DISK or
RESOURCETYPE_PRINT. If the DirectoryInfo returns don't indicate a type, you
may have to P/Invoke directly to the WNet call to get the information. I'd
look at Attributes, but it's not clear whether that would tell you anything
or not.
Paul T.
"Charles Teel" wrote in message @q21g2000hsa.googlegroups.com...
On Jan 31, 11:53 am, "Paul G. Tobey [eMVP]"
no instrument no spam DOT com> wrote:
> Is this really a *Compact* Framework question? It sounds like you're
> talking about desktop Windows. This group is about Windows CE/Windows
> Mobile, *not* Windows XP/Windows Vista .NET...
>
> Paul T.
Yes, this is a Compact Framework question, because the app is on a
Windows Mobile Device. Now, the PC that has the file and printer
shares is going to be a WinXP/Vista machine. But the code I'm writing
is on the mobile device. |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Thu Jan 31, 2008 5:35 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
At least on my CE5 device, DirectoryInfo doesn't indicate anything useful.
WNetEnumResources() gives the correct information for folders and printers.
Paul T.
"Paul G. Tobey [eMVP]"
com> wrote in message @TK2MSFTNGP04.phx.gbl...
> OK. So you have a list of resources and the problem is to identify which
> are printers and which are folders, yes? The underlying API for
> enumeration of network resources is WNetEnumResource(). The structure
> returned by that call includes a 'type' field which indicates either
> RESOURCETYPE_DISK or RESOURCETYPE_PRINT. If the DirectoryInfo returns
> don't indicate a type, you may have to P/Invoke directly to the WNet call
> to get the information. I'd look at Attributes, but it's not clear
> whether that would tell you anything or not.
>
> Paul T.
>
> "Charles Teel" wrote in message
> @q21g2000hsa.googlegroups.com...
> On Jan 31, 11:53 am, "Paul G. Tobey [eMVP]"
> no instrument no spam DOT com> wrote:
>> Is this really a *Compact* Framework question? It sounds like you're
>> talking about desktop Windows. This group is about Windows CE/Windows
>> Mobile, *not* Windows XP/Windows Vista .NET...
>>
>> Paul T.
>
> Yes, this is a Compact Framework question, because the app is on a
> Windows Mobile Device. Now, the PC that has the file and printer
> shares is going to be a WinXP/Vista machine. But the code I'm writing
> is on the mobile device.
> |
|
| Back to top |
|
 |
Paul G. Tobey [eMVP]
Joined: 08 Aug 2007 Posts: 185
|
Posted: Thu Jan 31, 2008 5:39 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
And, as usual, OpenNETCF has the enumeration calls for WNet in the Smart
Device Framework.
Paul T.
"Paul G. Tobey [eMVP]"
com> wrote in message @TK2MSFTNGP06.phx.gbl...
> At least on my CE5 device, DirectoryInfo doesn't indicate anything useful.
> WNetEnumResources() gives the correct information for folders and
> printers.
>
> Paul T.
>
> "Paul G. Tobey [eMVP]"
> com> wrote in message @TK2MSFTNGP04.phx.gbl...
>> OK. So you have a list of resources and the problem is to identify which
>> are printers and which are folders, yes? The underlying API for
>> enumeration of network resources is WNetEnumResource(). The structure
>> returned by that call includes a 'type' field which indicates either
>> RESOURCETYPE_DISK or RESOURCETYPE_PRINT. If the DirectoryInfo returns
>> don't indicate a type, you may have to P/Invoke directly to the WNet call
>> to get the information. I'd look at Attributes, but it's not clear
>> whether that would tell you anything or not.
>>
>> Paul T.
>>
>> "Charles Teel" wrote in message
>> @q21g2000hsa.googlegroups.com...
>> On Jan 31, 11:53 am, "Paul G. Tobey [eMVP]"
>> no instrument no spam DOT com> wrote:
>>> Is this really a *Compact* Framework question? It sounds like you're
>>> talking about desktop Windows. This group is about Windows CE/Windows
>>> Mobile, *not* Windows XP/Windows Vista .NET...
>>>
>>> Paul T.
>>
>> Yes, this is a Compact Framework question, because the app is on a
>> Windows Mobile Device. Now, the PC that has the file and printer
>> shares is going to be a WinXP/Vista machine. But the code I'm writing
>> is on the mobile device.
>>
>
> |
|
| Back to top |
|
 |
Charles Teel
Joined: 31 Jan 2008 Posts: 4
|
Posted: Thu Jan 31, 2008 4:43 pm Post subject: Re: DirectoryInfo and Network Shares |
|
|
On Jan 31, 1:35 pm, "Paul G. Tobey [eMVP]"
no instrument no spam DOT com> wrote:
> At least on my CE5 device, DirectoryInfo doesn't indicate anything useful.
> WNetEnumResources() gives the correct information for folders and printers..
>
> Paul T.
>
> "Paul G. Tobey [eMVP]"
Pinvoking WNetEnumResources() worked perfectly. Thanks!
|
|
| Back to top |
|
 |
|
|
| Related Topics: | Network Shares I am in the process of writing an application that has to get access to a share accross the network in C#. How do I get access to a network share using a different user name and password from the user that is logged in and running the application. I have
Directoryinfo not working in asp.net The code below could not locate the folder an files, though the folder and files exists when i use the Windows Explorer. Dim oDir As DirectoryInfo oDir = New If oDir.Exists Then
Get subdirectories on shares Hi, I have a small problem here, maybe someone can help me: I successfully retrieved a containing the shares on a remote machine. Now I want to get all folders under each share (first level is enough, doesn't have to be recursiv
Non Administrator creating shares on a DC I am trying to create a tool for new user creation so that our Help Desks can create users, home directories, the shares, and add them to groups. It was all good until I got to creating shares on the servers (some are DC's) I can't find ANY WAY to get ar
WMI and Network bridging Does network bridge have any dependency on WMI service? I just found if I stop WMI service, both of the adapters to connect the bridge are removed from the bridge (Oberserved from the property of the bridge, adapters are unchecked) |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|