Showing posts with label FTP. Show all posts
Showing posts with label FTP. Show all posts

Friday, October 21, 2011

FTP in and out of Dynamics AX

Axaptapedia has a good article on this:
http://axaptapedia.com/index.php?title=FTP_from_Axapta.

I pretty much followed their instructions and then tweaked the code to work for our needs.

Just a few notes on it:
1. I added the InteropPermission assert before setting the handle.
2. I had to use the IP address of our FTP server instead of the ftp.company.com address.
3. My set current directory looked something like "folder//subfolder" don't forget the double slashes.
4. My put file is on another server so I had to do something like (handle,"\\\\server\\folder\\folder2\\folder3\\xmlfile.xml","XMLFile.xml"); Lots of slashes involved.
5. The get file requires the handle, then the file you are going to get, then the file location and name that you want it to create.

The upload worked great. I'm having issues with the download, but only because I think the user that I'm logging into on the FTP server does not have permission to access the file location that I'm trying to put it to. I'll follow up on this post when we have it working. I could download it to my C: drive fine though. All in all, a success!