473,396 Members | 1,608 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,396 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 10960
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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,...
0
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...

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.