473,224 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

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 1276

"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
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.