This technical note describes how to use the Reflection FTP Type Libraries, which provide a COM API to automate secure file transfers. Code samples in C# and VBA are provided.
Reflection FTP Client is included in many Attachmate products, including the following:
Note: For information about automating SFTP file transfers using Reflection for Secure IT command line utilities, see Technical Note 2126.
SFTP transfers can also be automated using a recorded script. For information about using an FTP Client script see Technical Note 1308.
To automate file transfers, Attachmate Technical Support recommends first setting up an authentication method that does not require user input, such as Public Key Authentication with an empty passphrase. It is possible to send a password in your program; however, the security risk is greater when plain text passwords are saved in source code.
For detailed steps on configuring Reflection for public key authentication, see Technical Note 1881.
Reflection FTP 1.15 Type Library (RFTPCOM15.DLL) is included with Reflection next generation emulation productsReflection 2014 and Reflection 2011.
Reflection FTP 1.0 Type Library (RFTPCOM.DLL) is included with Reflection FTP Client 14.x, Reflection for Secure IT 7.x, EXTRA! 9.x, and INFOConnect Enterprise Edition 8.x.
To add a reference to Reflection FTP:
In a .NET project in Microsoft Visual Studio 2005 2010, go to Project > Add Reference.
Choose the COM tab and scroll to the FTP type library appropriate to your installation.
In Visual Basic for Applications, go to Tools > References.
Note: If you see both Reflection FTP 1.15 and 1.0 Type Libraries, you may have installed two incompatible versions of Attachmate products. One will need to be uninstalled before you can use the Reflection FTP API.
This example uses Reflection FTP 1.15 Type Library and works with Reflection 2014 and 2011. A variable is used to create a filter for file extensions. The application will transfer all files in a given directory that match the strFilter variable.
To see the .NET example:
strHostPath, strLocalPath, strFilter, and strLogFile.
This example uses Reflection FTP 1.0 Type Library and works with Reflection FTP 14.x and Reflection for Secure IT. VBA is used to create a filter for file extensions. The macro will transfer all files in a given directory that match the strFilter variable.
Using Reflection FTP Automation API, you can add features to your programs, such as checking to see if files exist before attempting a transfer, deleting files when you are done, writing error logs, or emailing system administrators when a critical file transfer fails.