Browse for a network folder

G

Guest

Im trying to write an application which goes through selected servers on the
network and (according to the file path provided) recurses through all
folders and deletes log files that fit a specified criteria.

This is working when passing UNC names between the methods, but the users
need to know the UNC path if the server isnt in the list currently held by
the app.

What the users need is the equivalent of the FolderBrowserDialog that will
accept a UNC path as the root directory. Is this possible? if so how can it
be done?

Cheers
 
O

Ollie Riches

I know that you can get information about the local LAN and the computers
connected it using the WIN32 API's
WNetEnumResource or NetServerEnum. These are unmanaged API and you will have
to use interop to access these methods, Note if NetBios is not availalble on
your network, then these APIs will not work.

WIN32 API WNetEnumResource
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetenumresource.asp

WIN32 API NetServerEnum
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netserverenum.asp


For information about using these API's from .Net (C#) check out the
following:

WNetEnumResource
http://www.pinvoke.net/default.aspx/mpr.WNetEnumResource?diff=y

NetServerEnum
http://pinvoke.net/default.aspx/netapi32.netserverenum

An interesting article on networking in .Net:
http://discuss.fogcreek.com/dotnetquestions/default.asp?cmd=show&ixPost=6605


For an example in Vb.Net of using he above API's check out
http://vbnet.mvps.org/index.html?code/network/wnetenumresource.htm


And finally for a Vb.Net to C# converter check out:
http://www.developerfusion.co.uk/utilities/convertvbtocsharp.aspx

HTH

Ollie Riches
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top