To start using the COM API, you create the SFTPCOMInterface.CIServer class object, and then apply the methods and properties in the object. For example:
Set SFTPServer = WScript.CreateObject("SFTPCOMInterface.CIServer")
' Get rule's statement with index 0
Below is the general sequence:
Add a COM library reference to your project (e.g., ‘Solution Explorer’ => Right click on ‘References’ => ‘Add Reference…’ => ‘COM tab’ => ‘SFTPCOMInterface 1.0 Type Library’)
Add a using directive to your sources:
Create the Server object:
CIServer server = new CIServer();
Connect to EFT:
server.Connect("Server_host", Server_port, "Admin_login", "Admin_Password");
Retrieve/modify sites, commands, users, event rules, and so on.
For example, to deal with Event Action statements (‘If’ statement and ‘Action’ statement), determine their exact types and then cast to it:
ICIEventRule rule = …;
if (((ICIEventRuleStatement)rule.Statement(0)).type == EventRuleStatementType.ActionStatement)
ICIActionStatement actionStatement = (ICIActionStatement)rule.Statement(0);
// manipulate with action
ICIIfStatement ifStatement = (ICIIfStatement)rule.Statement(0);
// manipulate with condition
The COM API does not allow changing Event Rules if the change violates the Rule’s integrity (invariant):
You cannot use an Action/Condition if it is forbidden for this Event (e.g., the AS2 Send Action is forbidden for On Server Stopped events).
You cannot change a Condition’s value/operator if the value/operator is inconsistent with the Condition (e.g., If Server Status Condition does not allow the Is One Of operator).
You cannot change an Action’s parameters if new ones are inconsistent (e.g., 'action.Params = PGPParams’ where PGPParams contains an empty file path or inconsistent pair, ‘Operation = Encrypt’ + ‘Empty Key ID list’).