?
Solved

Programmatically setting folder/file permission for sharing folders

Posted on 2004-09-22
8
Medium Priority
?
1,431 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 1200 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
Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

 

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 800 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 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