NAV2013 FTP without Libraries

Administrator
Member, Moderator, Administrator Posts: 2,506
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
Functions:
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.
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

Functions:
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.
1
Comments
-
Awesome! Checked, works great! ThanksThat's what she said!0
-
I think this solution works as long as you don't get any .net exceptions right?0
-
Hello,
these functions don't have any exceptions handling parts.
Igor Pchelnikov0 -
Hi,
Just wanted to say thank you for this upload. You saved me a lot of time.
Especially the idea to use
ResponseStream.CopyTo(SimpleStream);
on FTP download function was very helpful. =D> =D> =D>
Thanks.0 -
yeah, it was tricky to write the file to ftp request0
-
Hi,
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.
Thanks!0 -
Hi,
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
END;
I hope this helps.
Thanks.0 -
When using I get an error: The uri prefix was not recognized.
Why?0 -
Hi
I get the following error - any ideas?
Here is the code
//Call to Codeunit ()
ToFile := FileMan.ServerTempFileName('csv');
v_ExpFile.CREATE(ToFile);
v_ExpFile.TEXTMODE(TRUE);
CreateHeader; //Put in header information
CreateData; //Put in Line information
v_ExpFile.CLOSE;
FTPHandling2.UploadFile("FileName",'ftp://xxxxxx.dk/"Foldername"/',"LOGIN","Password");
Actual FTP-codeunit
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;
RealFileStream.CopyTo(SimpleStream);
SimpleStream.Close;
RealFileStream.Close;
0 -
Issue solved - i needed the "to be" filename in the url.0
-
Hi All,
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
UploadFile('E:\Bin\shan.txt','ftp.mydomain.com','user','pass');
0 -
try with the following
UploadFile('E:\Bin\shan.txt','ftp://ftp.mydomain.com','user','pass');0 -
When I try it, its giving me this error
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'
OK
0 -
shanabeywicrema wrote: »When I try it, its giving me this error
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'
OK
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?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions