473,657 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing a folder programmaticall y

How do you share a folder/directory programmaticall y? 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.Comm it) . 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 6113
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.co m

"Chuck" <ce*****@austin .rr.com> wrote in message
news:HI******** ***********@fe2 .texas.rr.com.. .
How do you share a folder/directory programmaticall y? 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.Comm it) . 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
8579
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 to it. Question: How can I do it programmatically without mapping the drive? full source code is most welcome!
5
10513
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 do this? (IIS 5 or 6 In case you're wondering why I would do this, we have many web sites on a single server, and there are groups of sites that need to share common configuration information. I'd like to ease some administration by having one...
1
1638
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"). I was simply thinking about programmatically attempting to create an instance of the DLL and handle the error if it didn;t exist but was thinking
0
1069
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 instantiating the FileSystemWatcher object with the local path eg. "C:\FolderName". There is another application on the intranet that will drop text files to this folder which my service will parse and then move the file either to an archive folder or...
5
2429
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 redistributable files (and it will launch the MSDE Setup.exe to install MSDE). I've read that "Except on Win 98 and Millennium, file and print sharing must be active"
16
7401
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 from a windows forms application?
8
1892
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. Thanks.
5
1452
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 controls, custom base classes for Master and Page objects, so on and so on. All of this was done on my main dev machine, which I've also been using to write the website. On the dev machine, the DLL references compile Just In Time with no errors....
0
1477
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 Users\\, who has a 2nd pc with window xp. They're getting all kinds of access errors relating to the .mdb being read-only, etc., when they try to access the database from the xp machine. Using remote control, I turned on sharing for that folder...
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
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.