File Moving issue Batch Job AX 2012

Hi All,

I had a class that runs and moves the file to another folder. Its working when i run without batch job. But when i run it with batch job its stuck in processing state and having issues at this code move()

perm = new FileIoPermission(destinationPath, #io_write);

Do i need to make any code changes here to make it work?

How do you run “without batch”? In X++ on client? In X++ on server? In CIL on server?

X++ on client.

Then you’re comparing completely different things (different machines, different user accounts, different execution environment), therefore there are many reasons why it may behave differently.

First try running your code in X++ on server. Maybe it’ll fail already, because you didn’t grant permissions for sourcepath, because the paths don’t exist on server or because the AOS service account doesn’t have permissions to access them. It would also prove that the problem isn’t related to batch and focusing on batch would be a waste of time.

If it works in X++ on server, try executing it in CIL. Only if it works in CIL on server but not in batch, you’ll have to resort to debugging the batch.

Try this link