Change File Ownership through X++ in Dynamics AX

Hi all , while working with AIF using file system adapter, it is very painful to update every time the owner of XML file , otherwise AX will not read the file and will throw the error , I have used icacls utility to update the ownership of file . I have modifed the class AIFFileSystemreceiveadapter , you can find it on skydrvie. https://skydrive.live.com/redir.aspx?cid=32417e20be1cdd11&resid=32417E20BE1CDD11!114

The changed code is as below  :

 select * from userInfo where userInfo.Id == curuserid();
 domain = System.Environment::get_UserDomainName();
 command = “/c” + ” icacls ” + filePath  + ” /setowner ”  +  domain + “\” + userInfo.networkAlias;
 WinAPI::shellExecute(“cmd.exe”, command);

Thanks,

Posted in: AIF

3 thoughts on “Change File Ownership through X++ in Dynamics AX”

Leave a Reply

Your email address will not be published. Required fields are marked *