Solved

Programmatically setting folder/file permission for sharing folders

Posted on 2004-09-22
8
1,426 Views
Last Modified: 2008-02-01
Hello!
I am trying to find a way of sharing a folder on the computer as a network share.
This is very easy done manually, but I need some help in finding out how this can be done programmatically.

I need to do the following (ASAP........)
1. Set a specified folder as a network share including access permissions.
2. Set the different properties for files/folders in the share

How can this be achieved?
Could somebody help me with some code examples?  Preferably in VB.NET, but C# is also OK.
Or links to pages that give this information?

Thank you for your input!
Jorn
0
Comment
Question by:epihandy
  • 3
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
mAjKoL earned 300 total points
ID: 12130751
0
 

Author Comment

by:epihandy
ID: 12130812
Thanx, this looks very promising!
I will look at it at check whether this solves it!
Be back!
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12131453
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:epihandy
ID: 12132193
The last sample is working and is able to create the share, however I don't understand how to set the different security settings of the folder.
It needs to be different for different users. It only shares the folder with full permissions for all, and that is very risky......

I found this info, but that was all:
In SHARE_INFO_502 structure you can specify the permissions by specifying a Security Descriptor that has the required ACL. If you set the value of shi502_security_descriptor variable to 0, then a null DACL is set on the file share meaning that Everybody has full access to this share.

Thanx
0
 
LVL 18

Assisted Solution

by:armoghan
armoghan earned 200 total points
ID: 12132396
these links may help you learn more about the network API
http://custom.programming-in.net/articles/art9-2.asp?lib=netapi32.dll
http://www.codeproject.com/csharp/groupandmembers.asp


the article is also present here and you can communicate with the Author

http://www.codeproject.com/dotnet/pinvokeaddshare.asp

I have not worked on this thing in depth :(
0
 

Author Comment

by:epihandy
ID: 12338107
Just a minute!
I will split the points!
Sorry for the delay!
I simply forgot to do it!
THANX FOR YOUR ANSWERS!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question