connecting to FTP server via AX 2012

hI ,

I want to connect to FTP server via ax 2012 and retrieve the list of files still present in the repository directory.

can you help me?

It’s been already discussed several times - a search engine will help you to find what you need, without having to ask here. Dynamics AX 2009: FTP Adapter for AIF is one of things that you would find.

Is there a way to do that without AIF ?

Of course, because it has nothing to do with AIF at all. The point is using .NET API for FTP through .NET Interop; that the example above uses the code for implementing an AIF adapter is irrelevant. You’ll rarely get an example that implements exactly what you need. Use your intellect to identify what’s related to FTP.

i have try that but i get this error Impossible create ‘CLRObject’

static void uploadTestFile(Args _args) {

System.Object ftpo;

System.Object ftpResponse;

System.Net.FtpWebRequest request;

System.IO.StreamReader reader;

System.IO.Stream requestStream;

System.Byte[] bytes;

System.Net.NetworkCredential credential;

System.String xmlContent;

System.Text.Encoding utf8;

System.Net.FtpWebResponse response;


// Read file

reader = new System.IO.StreamReader(“”);

utf8 = System.Text.Encoding::get_UTF8();

bytes = utf8.GetBytes( reader.ReadToEnd() );


// little workaround to get around the casting in .NET

ftpo = System.Net.WebRequest::Create(“”);

request = ftpo;

credential = new System.Net.NetworkCredential(“log”,“pass”);




// “Bypass” a HTTP Proxy (FTP transfer through a proxy causes an exception)

// request.set_Proxy( System.Net.GlobalProxySelection::GetEmptyWebProxy() );

requestStream = request.GetRequestStream();



ftpResponse = request.GetResponse();

response = ftpResponse;



Which object are you talking about? There is more than one in your code.

the issue i d’t understand what ax mean by CLRObject could not be created

but i thank the problem is to connecting to FTP so the object is response

i thank i have an error in this code

It means that an exception is thrown when creating a .NET object (CLR stands from Common Language Runtime, but you can safely think about it as .NET). You won’t be able to fix it unless you identify which object (which line of code) it’s related to. That’s the same for all exceptions, being thrown by AX runtime or CLR.

thank you ,

now i can read , and upload file to FTP server , now i m looking for how to delete file into FTP,