473,387 Members | 1,597 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,387 software developers and data experts.

Removing a folder share?

pnp
Hi all,
How can I remove a specific folder share from a folder, through C# code?

Thanks in advance,
pnp
Nov 16 '05 #1
3 10955
This is one way: Process.Start ("net share <share name> /delete");

"pnp" <pnp.@.softlab.ntua.gr> wrote in message
news:eD**************@TK2MSFTNGP15.phx.gbl...
Hi all,
How can I remove a specific folder share from a folder, through C# code?

Thanks in advance,
pnp
Nov 16 '05 #2
Here's a good link. The code is VB.NET, but it does the trick. These
examples use WMI to manipulate shared resources.

--- Nick

"pnp" <pnp.@.softlab.ntua.gr> wrote in message
news:eD****************@TK2MSFTNGP15.phx.gbl...
Hi all,
How can I remove a specific folder share from a folder, through C# code?

Thanks in advance,
pnp

Nov 16 '05 #3
using System.Management;

....
int ret = DeleteShare(someshare);
....
static int DeleteShare(string shareName)
{
using (ManagementObject o = new ManagementObject("root\\cimv2",
"Win32_Share.Name='" + shareName +"'", null))
{
ManagementBaseObject outParams = o.InvokeMethod("delete", null, null);
return (int)(uint)(outParams.Properties["ReturnValue"].Value);
}
}

Willy.

"pnp" <pnp.@.softlab.ntua.gr> wrote in message
news:eD****************@TK2MSFTNGP15.phx.gbl...
Hi all,
How can I remove a specific folder share from a folder, through C# code?

Thanks in advance,
pnp

Nov 16 '05 #4

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

Similar topics

4
by: Dave | last post by:
I have an application where I am providing the user the ability to select or create a folder on a domain, using SHBrowseForFolder. When the user selects/creates a folder on a remote computer, it...
0
by: amit | last post by:
Hi. I need two regular expressions that will work in .Net The first one is for valid unc paths to file shares.. server,share,folder names can be any vailid windows name so these are valid...
2
by: flat_ross | last post by:
Hi, I am in a shop where developers are required to work off of a network share. This is so that code is backed up nightly. So I am testing running an ASP.NET Web application with a Class...
11
by: ASP.NET User | last post by:
Hi I am in a shop where developers are required to work off of a networ share. This is so that code and other documentation is backed up nightly. This is outside the realm of Visual SourceSafe...
3
by: Aaron | last post by:
My application will only be used on windows based machines. I need to open a folder using UNC naming. i.e. \\server\share\folder I do not need to do anything programatically with the folder...
6
by: Jeff | last post by:
Hi - I understand how to create a directory folder, but how can I programatically create a _shared_ directory folder and set its permissions?? (I'm using VB.NET.) Thanks for your help. -...
9
by: Rob Meade | last post by:
Hi all, Ok - so I've got the array thing going on, and the session thing going on, and up until now its all been ok. I've got my view basket page which is displaying 3 rows (as an example) - I...
0
by: saratchev | last post by:
Hi all i write a script to syncronize a web folder with a normal one. I want to copy all the files from the normal folder to the web folder. How can a reference the web folder? I have already...
2
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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,...

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.