The sample C# code below demonstrates how to fetch a CSV file from a remote FTP server (using third-party library) and loading its content as input provider for the Data List command. Sample agent is attached to this article.
public class Script
//See help for a definition of DataProviderArguments.
public static CustomDataStorage ProvideData(DataProviderArguments args)
var server = "ftp://ftp.dlptest.com/";
var port = 21;
var username = "email@example.com";
var password = "fLDScD4Ynth0p4OJ6bW6qCxjh";
var remoteFilePath = "testfolder/testInput.csv";
var cds = new CustomDataStorage();
var tempFile = Path.GetTempFileName();
FluentFTP.FtpClient client = null;
using (client = new FluentFTP.FtpClient(server, port, username, password))
// Connect to the server
// Download file
if (client.DownloadFile(tempFile, remoteFilePath, true, FluentFTP.FtpVerify.None, null))
// Load downloaded csv file.
cds = args.ScriptUtilities.LoadCsvFile(tempFile, true);
throw new Exception("Failed to download file: " + remoteFilePath);
catch (Exception ex)
// Delete temporary file
if (File.Exists(tempFile)) File.Delete(tempFile);
if (client != null) client.Disconnect();
Required third-party library: FluentFTP. Download the DLL into your Agent's "Assembly" folder, and add "FluentFTP.dll" in your Agent's Assembly References. The DLL is already added and set up in the attached sample agent.