Solved

Programmatically setting folder/file permission for sharing folders

Posted on 2004-09-22
8
1,423 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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
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:…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now