Share via


Retrieve shared folders on a network computer using C#

Question

Tuesday, June 14, 2011 9:54 AM

i have a list of all directories of network computer but i want to access only shared folders.

PLZ help me

All replies (1)

Tuesday, June 14, 2011 1:02 PM âś…Answered

There are a number of considerations.

For example, what level of securtiy has been assigned to your executable.

Perhaps you could go into greater detail as to what you are attempting to achieve.

Note:  AFAIK, you can not "retrieve" shared folders, only their contents.

i.e.:  get shared folder name; create your local empty folder;

       for each file, copy to your local folder.

       repeat for all sub-folders in the shared folder.

TIMTOWTDI.  Example:  you could programatically shell and use a command like XCOPY.

g.

Examples (you may find these somewhat helpful):

http://stackoverflow.com/questions/677221/copy-folders-in-c-using-system-io

http://stackoverflow.com/questions/4690227/how-can-i-see-which-shared-folders-my-program-has-access-to

http://www.eggheadcafe.com/community/aspnet/2/10116970/accessing-shared-folder-on-a-network-using-c-code.aspx

http://www.techtalkz.com/c-c-sharp/115668-accessing-unc-file-share-credentials.html

You can find more via Google with search arguments like:

     access shared folders programmatically c# windows