Exchange API

Overview

These public interfaces are used in Exchange components. They are provided for implementing advanced functionality in your scripts. In order for you to use these interfaces in your project, you have to reference CozyRoc.SSISPlus.dll and Microsoft.Exchange.WebServices.dll libraries. Also include CozyRoc.SqlServer.SSIS and optionally Microsoft.Exchange.WebServices.Data namespaces.

IExchangeConnection

When you call Exchange Connection Manager AcquireConnection method, it returns object implementing IExchangeConnection interface. This is the interface used for interaction with Exchange mail server.

Connect method

Connects to Exchange mail server. The result is IMailClient object.

Close method

Closes the connection to an Exchange mail server. Use always after you finish working with the server. You may also dispose the returned object from Connect method as alternative.

IsConnected method

Returns true if connected to the server.

GetService method

Returns underlying Exchange service object.

CopyMail method

Copies mail to destination folder. These are the method parameters:

  • mi (IMailInfo) – mail information object.
  • destinationFolder (string) – destination folder.

CreateFolder method

Creates mail folder. These are the method parameters:

  • folder (string) – folder name.

DeleteFolder method

Deletes mail folder. These are the method parameters:

  • folder (string) – folder name.

GetFolders method

Gets list of mail folders. These are the method parameters:

  • parent (string) – parent folder for which to retrieve list of folders. Set to empty to get list of root folders.

AutoDiscover property (bool)

Specify to auto-discover host address from specified user name. This property has the options listed in the following table.

Value Description
True Auto-discover host address (default).
False Host address has to be explicitly specified.

ServerHost property (string)

Specify the name or IP address of the Exchange mail server.

ServerUser property (string)

Specify user name to access the Exchange mail server.

ServerPassword property (string)

Specify user password to access the Exchange mail server.

Mailbox property (string)

Specify entry Exchange mailbox. To specify sub-mailbox use backslash (\).

ServerTimeout property (int)

Specify the number of seconds before timing out session connect. The default value of this property is 100 seconds.

RetainSameConnection property (bool)

Specify if all clients should use the same connection. This property has the options listed in the following table.

Value Description
True All clients use same connection (default).
False Every client use different connection.

ProxyHost property (string)

Specify the name or IP address of the proxy server.

ProxyPort property (int)

Specify the port number on the proxy server to use for the connection.

ProxyUser property (string)

Specify user name to access the proxy server.

ProxyPassword property (string)

Specify password to access the proxy server.