Our support engineers have assembled the top recommended solutions for you.
Microsoft Dynamics AX 2012CRM Connector in Microsoft Dynamics AX 2012Financials Management in Microsoft Dynamics AX 2012Upgrading to Microsoft Dynamics AX 2012
Microsoft Dynamics AX 2009
Application Object Server (AOS)
Enterprise Portal and Role Centers
Inventory Costing in Microsoft Dynamics AX 2009
SSRS and SSAS Integration
I encountered the following error when I'm trying to run a batch job with a process of Moving File:
ClrObject static method invocation error.
System.UnauthorizedAccessException: Access to the path is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Move(String sourceFileName, String destFileName)
Here's my code and it's working fine only in client:
static client server boolean MoveFile(FileName _srcFile, FileName _destFile, boolean _overwrite = true)
Set permSet = new Set(Types::Class);
permSet.add(new FileIOPermission(_srcFile, 'rw'));
permSet.add(new FileIOPermission(_destFile, 'rw'));
ex = ClrInterop::getLastException();
if (ex != null)
ex = ex.get_InnerException();
if (ex != null)
I wonder what I'm missing here. Any help will be appreciated! Thanks
I guess the user running the AOS does not have write permission in this folder. That permission must be set in Windows, granting a FileIOPermission does not help if Windows does not allow access to the path.
Hi, Thanks for the quick reply. Yes, Granting Folder Permissions work.
I addition to what Jonas said:
Please have in mind that server-side code is executed in context of windows account/domain account of the AOS service, while code on AX client acts on behalf of current user.
This scenario can lead to some non-obvious errors like above.
aximprove.co.uk : Triage,Code Scrambler, Licence Guard, Advanced Data Management for SQL Server
Is it possible to assign the file access credentials through code (if these are known)? I have a similar situation, where the files that I am accessing are not on a server within the domain, but I have been provided the user name and password for this folder.
So for my class to run, i need to first log in to the folder, and then execute the class. This can be done easily on the client, but all the functions that do this are client only, and fail when the class is run as a batch.
I think it's best if you just grant folder permission to Full Control to the account of your AOS. For example, the execution account of my AOS is NETWORK SERVICE, so I always see to it that my folder grants full control to NETWORK SERVICE.
The main issue for me is that I am not allowed to access the domain form the external server, (which is not on the same domain - actually it is not on any domain).
As a client process, i am using winAPI::ShellExecute to run a cmd file that will pass the credentials to the external server (using NET USE).
The trouble is i cannot use winAPI::ShellExecute when I am running the process as a Batch task.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Use the official Twitter tags:
#MSDYNCOMM | #CONV13