To Set Folder,File read,write Permission from AX you can try below code . Just you need to pass Domain,Folder parameter in function as root and stFolder as mention in function below.
void setAccess(str root, str stFolder)
{
System.Security.AccessControl.DirectorySecurity DirectorySec;
System.IO.DirectoryInfo dirInformaiton;
System.Security.AccessControl.FileSystemAccessRule FilesysaccessRule;
System.Security.AccessControl.FileSystemRights fileSysRights;
System.Security.AccessControl.AccessControlType accessControlType;
UserInfo UserInfo;
SHRDocuFolder LtabSHRDocuFolder;
System.Security.AccessControl.InheritanceFlags inheritFlags;
System.Security.AccessControl.PropagationFlags propFlags;
;
dirInformaiton = new System.IO.DirectoryInfo(_root);
DirectorySec = dirInformaiton.GetAccessControl();
fileSysRights = System.Security.AccessControl.FileSystemRights::Write;
inheritFlags = System.Security.AccessControl.InheritanceFlags::ObjectInherit;
propFlags = System.Security.AccessControl.PropagationFlags::NoPropagateInherit;
accessControlType = System.Security.AccessControl.AccessControlType::Allow;
FilesysaccessRule = new System.Security.AccessControl.FileSystemAccessRule(identity, fileSysRights, inheritFlags, propFlags, accessControlType);
DirectorySec.AddAccessRule(FilesysaccessRule);
dirInformaiton.SetAccessControl(DirectorySec);
}