This post I dedicated in how to upload a file on FTP from NAV. This normally happens when we are doing some sort of processing from a file which has to be processed needs to be downloaded from a FTP and then eventually needs to be processed.
Recently i have worked on a project where the requirement was to upload and download the files from a FTP. In this blog i will be explaining how to download the files using .NET Interop. There are several other blogs which have explained, how to download the files using ScriptingHost or .net interop but i have not found an example to download all the files from a particular folder.
I had a request the other day to help a customer create a purchase order export file, and then transmit the file to the vendor via FTP automatically. Back in the olden days of NAV (which I know about because I’m a grizzled veteran of NAV development, complete with gravelly voice), you’d use the SHELL command to send things to the command line; however, in the modern world of the RTC in NAV 2009 and beyond, you can’t do that anymore. Fortunately, we’ve got the Windows Script Host Object Model objects to help us out.
In many data exchanges it is desired that a file be removed from the remote FTP server once it has been downloaded. Building on the previous posts (List, Upload, Download) that extend FTP within Microsoft Dynamics NAV via dotNET Interop, the code listed below demonstrates how to remove a file via FTP.
This post continues the demonstration of extending the .NET Framework in Microsoft Dynamics NAV to transfer files via FTP. We have already reviewed Uploading Files and Downloading Files via FTP from within Microsoft Dynamics NAV. Another important part of exchanging files via FTP is the listing of files on the remote server. The following code can be used to list the files on an FTP server.