Data import from FTP server

Hi everyone, 

I'd like to automate a data Import from a FTP server using a business process, without downloading the file locally.

I also found this article (https://community.creatio.com/questions/how-automate-imports-ftp-locati…) , but the links have either been removed or deleted.

I would like to know whether it is possible to use C# code in a Script Task to store the data stream in RAM and eventually recover the data to import. 

Is it reasonable for a cloud- stored enviroment to handle this kind of process with CSV files of approx. 2 MB?

Like 1

Like

3 comments

Hi Federica, 

 

Actually you are still capable to use OData with business task to achieve required implementation. You don't need to use Scheduler for this, so disregard these deleted links, I will give you fresh one , please take a look on the actual OData 4 link with guide how to set up the integration: 

 

https://documenter.getpostman.com/view/10204500/SztHX5Qb?version=latest

 

Please also check out this link from Marketplace where you may find another solution for you task: 

 

https://marketplace.creatio.com/app/file-manager-creatio

 

here you may set up key features of needed requirements, so you can make "One click" implementation and it might be much easier for you.

 

Best Regards, 

 

Bogdan L. 

The .NET FtpWebRequest class can download a file to an in-memory stream (without actually saving the file anywhere) that you can then process from the stream. This could be used from a ScriptTask in a process etc

FtpWebRequest request =
    (FtpWebRequest)WebRequest.Create("ftp://ftp.example.com/path/file.txt");
request.Credentials = new NetworkCredential("username", "password");
request.Method = WebRequestMethods.Ftp.DownloadFile;
 
using (Stream stream = request.GetResponse().GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
    while (!reader.EndOfStream)
    {
        string line = reader.ReadLine();
        // process the line as needed
    }
}

Ryan

Ryan Farley,

That's the script I'm running at the moment and it works!

Show all comments