fileIOPermission = new FileIOPermission(fileName, 'w'); --> set only global
permission.
We didn't find the code for:
- setting folder permission
- setting file/folder permission per group/person
Thanks in advance for helping us!
There are several ways in .NET how you can do this.
Please take a look at these articles describing some of the ways (incl.
sample code):
http://support.microsoft.com/kb/899553
http://www.redmondpie.com/applying-permissions-on-any-windows-folder-using-c/
http://weblogs.asp.net/cumpsd/archive/2004/02/08/69403.aspx
http://mikevandermeulen.com/Blog/tabid/55/EntryId/15/Setting-File-Folder-Permissions-in-C.aspx
Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
thanks for your links. I'm really sorry, but we do not have the know how to
call these .NET codes from AX. Could you get us an example?
thank you!
best regards
Thank you for your links. unfortunately we do not have the know how calling
.net codes from ax. could you please get us an example?
thank you.
best regards.
YW
currently i have no sample code/example on hand which fits to your needs.
Sorry about that.
But each Link provides also some sample code demonstrating the things.
The sample code create a outlook appointment over .Net.
The sample code is fully witten in AX.
void setAccess(str _root, str _LstrFolder)
{
//Directory
System.Security.AccessControl.DirectorySecurity dirSecurity;
System.IO.DirectoryInfo dirInfo;
//File
System.Security.AccessControl.FileSecurity fileSecurity;
System.IO.FileInfo fileInfo;
//Access rights and user identification
System.Security.AccessControl.FileSystemAccessRule accessRule;
System.Security.AccessControl.FileSystemRights fileSystemRights;
System.Security.AccessControl.InheritanceFlags inheritanceFlags;
System.Security.AccessControl.PropagationFlags propogationFlags;
System.Security.AccessControl.AccessControlType accessControlType;
UserInfo UserInfo;
SHRDocuFolder LtabSHRDocuFolder;
;
dirInfo = new System.IO.DirectoryInfo(_root);
// Get a DirectorySecurity object that represents the current security
settings.
dirSecurity = dirInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
//identity = "Domain\\Name";
fileSystemRights = System.Security.AccessControl.FileSystemRights::Write;
//:Write;
inheritanceFlags =
System.Security.AccessControl.InheritanceFlags::ObjectInherit;
propogationFlags =
System.Security.AccessControl.PropagationFlags::NoPropagateInherit;
accessControlType = System.Security.AccessControl.AccessControlType::Allow;
accessRule = new
System.Security.AccessControl.FileSystemAccessRule(identity,
fileSystemRights, inheritanceFlags, propogationFlags, accessControlType);
//set directory access
dirSecurity.AddAccessRule(accessRule);
// Set the new directory access settings.
dirInfo.SetAccessControl(dirSecurity);
}