ExportFile
Associated with: DNP3 SCADAPack E outstations and DNP3 SCADAPack Remote E outstations
Security permission required to access this method: Configure
Use this method to either:
- Export a file from a SCADAPack E outstation in the Geo SCADA Expert database, to a disk file on the main server.
(To export the file to a disk file on a ViewX client, use the Export button on the Configuration Setup window (see Export a File from a SCADAPack E Outstation’s Configuration).)
- Return the content of a file in the Geo SCADA Expert database, to enable that file to be accessed from a client (so that, for example, the file’s content can be saved on the client’s disk).
Arguments:
- SrcFileName (String)—Specify the name of the file that is stored in the Geo SCADA Expert database.
- DstFileName (String)—To export the above file from the database to a file on disk on the main server, specify the export destination for the file. Ensure that you specify the full path to the file.
To return the content of the file in the database, specify an ‘empty’ variant (rather than an empty string) for this argument (as per the example below).
Returns:
- The ExportFile method returns a byte array containing the file content if the DstFileName argument is an ‘empty’ variant. (No File information is returned if DstFileName is used to specify a file name.)
Example:
This example demonstrates how a Microsoft® JScript program might be used to obtain the content of a file in the database using the ExportFile method. In this particular example, the file, named ‘Config.log’, is associated with the DNP3 SCADAPack E outstation database item named ‘My Outstation’.
Because the file’s content is being returned rather than exported, the DstFileName argument (called ‘Dest’ in this example) is specified as an ‘empty’ variant:
function ExportFile()
{
var Dest;
var Outstation = Server.FindObject("My Outstation");
var File = Outstation.Interface.ExportFile("Config.log",
Dest);
var BinaryStream = new ActiveXObject("ADODB.Stream");
BinaryStream.Type = 1;// Binary
BinaryStream.Open();
BinaryStream.Write( File );
BinaryStream.SaveToFile( "D:\\Config.log", 2 );
BinaryStream.Close();
}