473,503 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing a folder programmatically

How do you share a folder/directory programmatically? The DOS way is << net
share -sharename- = -location- >> I could use Process, but that means
launching a command window to execute the 'net share' command.
I want to do this from within C# code (Installer.Commit) . I don't care if
the answer is in C# or WIN32 API. If someone could show me how to wrap and
use Win32's NetShareAdd, I would appreciate it.

If you have any other ideas, I would also like to hear about them.

Right now we have to manually share some folders whenever we do an install.
Mistakes happen and when the folders aren't shared my application can't move
files into and out of the un-shared directory and customers get very
unhappy!
Thanks
Chuck
Nov 16 '05 #1
1 6081
Chuck,

I have placed the definition for NetShareAdd, as well as the
SHARE_INFO_2 and SHARE_INFO_502 structures on PInvoke.net. You should be
able to find them there.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chuck" <ce*****@austin.rr.com> wrote in message
news:HI*******************@fe2.texas.rr.com...
How do you share a folder/directory programmatically? The DOS way is << net share -sharename- = -location- >> I could use Process, but that means
launching a command window to execute the 'net share' command.
I want to do this from within C# code (Installer.Commit) . I don't care if the answer is in C# or WIN32 API. If someone could show me how to wrap and use Win32's NetShareAdd, I would appreciate it.

If you have any other ideas, I would also like to hear about them.

Right now we have to manually share some folders whenever we do an install. Mistakes happen and when the folders aren't shared my application can't move files into and out of the un-shared directory and customers get very
unhappy!
Thanks
Chuck

Nov 16 '05 #2

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

Similar topics

3
8567
by: DotNetUser | last post by:
I know the Domain, UserName, Password and folder on the domain:\\inpsol301\home$\abc Supposed I can use UserName, Password and Window Explore to map the folder above to X: and then write a file...
5
10496
by: BPearson | last post by:
Hello I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to...
1
1627
by: John | last post by:
Hi all, How do I programmatically check for the existence of a DLL in the BIN folder prior to using it? I don't want to hard-code the path (i.e. "C:\InetPub\wwwroot\mysite\bin\MyDLL.dll"). ...
0
1047
by: CPragash | last post by:
Hello All, I'm developing a FileSystemWatcher Service using VB.NET to monitor a network shared folder. The folder actually resides on the same server where the service is running and I'm...
5
2422
by: Jeff | last post by:
Hi - I'm creating an installation program that will install a VB.NET program and an instance of MSDE on an unknown desktop (commercial application). The install will include the MSDE...
16
7366
by: Phil Hey | last post by:
Hi, I can change the icon for a folder by right clicking on it > going to the customize tab > and selecting Choose Picture. Does anyone know if it is possible to do this programmatically...
8
1887
by: Kissi Asiedu | last post by:
I have a database in a shared folder, however users with permission can only access the database in read-only format. What have I done wrong? This is on Win Xp Pro and Access 2003. Please help. ...
5
1447
by: Gregory Gadow | last post by:
All done in ASP.Net 2.0 using VB... The website I am developing has a large DLL that includes custom MembershipUser, MembershipProvider and RoleProvider classes, several frequently used web...
0
1468
by: ARC | last post by:
Hello all, This is really a computer sharing / network question, so sorry for posting here; it's the only newsgroup I post in. I have a customer with a database file on a vista machine under...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7280
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,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
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
7462
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
5014
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
3167
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
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.