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!
Is this job worked in Batch ?
ReplyDeleteYes, you can batch this process.
Deletehi Amber,
ReplyDeleteI am totally new here but glad to come across your post coz I have a question on that article and since you did use it, hopefully you can give some pointers..
in the section for the 'new' method, there is this "_winInet" argument all over the place, which gives a compile error. It should be declared somewhere. Is this a typo of some kind?
Thanks
--Tom Romny Kryosis--
It is in the classDeclaration of the WinInet class in standard AX. You must not be referencing the WinInet class if your code doesn't recognize the variable.
DeleteThe article tells you which variables to ADD to the WinInet class, but there are already many variables in it, _winInet being one of them. Hope that helps. Go to your AOT and go to classes and find WinInet. You will see the variable in the classDeclaration.