Below code uses System.Net.Ftpwebrequest package in AX to integrate with FTP. This job demonstrates how to delete a file from FTP folder. Refer WebRequestMethods.Ftp Class for different actions.
static void FTPUploadFile(Args _args)
{
System.Object ftpo;
System.Net.FtpWebRequest request;
System.IO.StreamReader reader;
System.IO.Stream stream;
System.IO.Stream responseStream;
System.Net.NetworkCredential credential;
;
ftpo = System.Net.WebRequest::Create("ftp://ftp.url.com/foldername/filename.txt");
request = ftpo;
credential = new System.Net.NetworkCredential("username", "password");
request.set_Credentials(credential);
request.set_Method("DELE");
request.set_UsePassive(true);
request.set_UseBinary(true);
request.set_KeepAlive(false);
request.GetResponse();
}
Regards,
Arun
No comments:
Post a Comment