Solved

Programmatically setting folder/file permission for sharing folders

Posted on 2004-09-22
8
1,427 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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