NAV2013 FTP without Libraries
No need of DLL. RAW FTP commands implementation with .NET 4.
This lib was tested with 2013 both NAS and RTC. After some magic should also work on 2009 RTC. Use and enjoy
GetFilesList, UploadFile, UploadFiles, DownloadFile, DownloadFiles
Easy-to use, .NET Framework only based, no need of additional software or whatever.http://www.mibuso.com/dlinfo.asp?FileID=1539
Discuss this download here.
these functions don't have any exceptions handling parts.
Just wanted to say thank you for this upload. You saved me a lot of time.
Especially the idea to use
on FTP download function was very helpful. =D> =D> =D>
Firstly thanks for sharing this utility
When using this, we get occasional errors from the GetRequestStream method e.g.
A call to System.Net.FtpWebRequest.GetRequestStream failed with this message: The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
A call to System.Net.FtpWebRequest.GetRequestStream failed with this message: Unable to connect to the remote server
This is running on a NAV2013 NAS and gives an error which halts the job that is set to run every 60 minutes.
Could you offer any advise on how to code around this error so that it doesn't error the Job Queue Entry if it happens? i.e. what could I test before running GetRequestStream ??
Using the libraries as per your download - not changed anything.
I think you can use the option to check the return value of the codeunit
IF CODEUNIT.RUN(CODEUNIT::"FTP send") THEN BEGIN
END ELSE BEGIN
//ignore if there is an error or use lasterrormsg and write in the job queue log
I hope this helps.
I get the following error - any ideas?
Here is the code
//Call to Codeunit ()
ToFile := FileMan.ServerTempFileName('csv');
CreateHeader; //Put in header information
CreateData; //Put in Line information
UploadFile(FileNameToUpload : Text;UploadToFtp : Text;Login : Text;Password : Text)
FTPRequest := FTPRequest.Create(UploadToFtp);
Credentials := Credentials.NetworkCredential(Login,Password);
FTPRequest.Credentials := Credentials;
FTPRequest.KeepAlive := TRUE;
FTPRequest.Method := 'STOR';
FTPRequest.UsePassive := TRUE;
FTPRequest.UseBinary := TRUE;
RealFileStream := FileStream.OpenRead(FileNameToUpload);
SimpleStream := FTPRequest.GetRequestStream;
I am getting this error when call the uploadfile
This message is for C/AL programmers: A call to System.Net.FtpWebRequest.Create failed with this message: Invalid URI: The format of the URI could not be determined.
This is how I pass the parameters
Microsoft Dynamics NAV
This message is for C/AL programmers: A call to System.Net.FtpWebRequest.GetRequestStream failed with this message: The remote name could not be resolved: 'ftp.mydomain.com'
The error is quite clear in my opinion? Looks like you are trying to connect to server: ftp.mydomain.com. Is an FTP service listening at this domain name?