473,473 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sharing windows folder

All,

How do I share Windows folder programatically? Which namespace/class to look
for?

Thanks in advance for your help.

regards,
Anand
Jan 18 '06 #1
1 1286

"Anand G" <an****@hp.com> wrote in message
news:43******@usenet01.boi.hp.com...
| All,
|
| How do I share Windows folder programatically? Which namespace/class to
look
| for?
|
| Thanks in advance for your help.
|
| regards,
| Anand
|
|

System.Management and the WMI class Win32_Share.

Following is a sample, that exports c:\\temp as Testshare...

public enum SharedDevice{
Disk = 0,
PrintQueue = 1,
Device = 2,
IPC = 3
}
....
using (ManagementClass o = new ManagementClass("root\\cimv2",
"Win32_Share", null))
{
ManagementBaseObject inputArgs = o.GetMethodParameters("Create");
inputArgs["Name"] = "Testshare";
inputArgs["Path"] = "c:\\temp";
inputArgs["Description"] = "This is public test share";
inputArgs["Type"] = SharedDevice.Disk;
ManagementBaseObject outParams = o.InvokeMethod("Create", inputArgs,
null);
uint ret = (uint)(outParams.Properties["ReturnValue"].Value);
if(ret != 0)
// handle failure....
}
}

Willy.
Jan 18 '06 #2

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

Similar topics

0
by: Marco | last post by:
Hello everybody, I have a little Access application that is composed by two MDB files. I have stored the tables in the first MDB file, and the other objects (forms, reports, queries, etc.) in the...
5
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...
0
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...
0
by: Henrik Gøttig | last post by:
Hi group I am investingating how I can turn on proxy type sharing from the IDE. I am aware that I can do that from the sharetypes switch on the command-line to wsdl.exe If I have a ASP.NET...
1
by: bruce.1 | last post by:
I'm trying to figure a way for a remote user -- using ASP.NET -- to share files on a local office LAN. The remote user would go to an ASP.NET website (on the LAN), mark the files they want, and...
8
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
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...
8
by: antonyliu2002 | last post by:
We are extending a web application written in classic ASP long time ago. We will add more components to this web application in ASP.NET 2.0. To use the web application, our web users will have...
0
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
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
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...
1
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.