Custom CDO Configuration

To configure CDO, follow these steps:

  1. Set up a Java-Exchange user account. This is the account to be used by your Java program to access Exchange objects (folders, messages, contact items, etc.). A Java-Exchange user can be any user in the domain that has a mailbox.

  2. Set up a Windows machine where CDO will be hosted. We will call this the "CDO host machine." This could be the same machine as the Exchange Server. However, due to security considerations, you may not be allowed to do any installations and configurations on the Exchange Server. In this case, you would need to use a separate machine to host CDO. The "CDO host machine" and Exchange Server must be in the same domain.

    On the CDO host machine, you need to either install MS Outlook or install the standalone version of CDO packaged with a MAPI client. CDO uses the MAPI subsystem as the underlying architecture to facilitate communication with Microsoft Exchange. If you choose to install MS Outlook, please note that the Outlook COM Object will not be used to access the Exchange Server. The main reason for installing Outlook instead of the standalone version of CDO is if you want the Outlook application to be available for regular use.

  3. Check if CDO.DLL is installed in the CDO host machine. CDO.DLL is usually saved in C:\Program Files\Common Files\System\MSMAPI\1033 when you install MS Outlook. If you find CDO.DLL in the CDO host machine, proceed to step 4. If you do not find CDO.DLL in the CDO host machine, you will have to install it as detailed in this knowledge base article. After installing CDO.DLL, register it by running regsvr32 as follows:
  4.       regsvr32 CDO.DLL

    After running regsvr32, you should see a message saying that CDO.DLL has been successfully registered.

  5. Download the J-Integra® for Exchange SDK from this link. Unzip the package to a folder in the CDO host machine. If you unzip the package to the C:\ drive, a directory structure containing C:\jintegra as the root directory will be created for you. If you will not be running your Java application on the CDO host machine, you will not be needing the whole package - just some executables located in the C:\jintegra\bin directory. Make sure that you add C:\jintegra\bin in the system path of the CDO host machine so you can run these executables from any directory.

  6. Create a surrogate for CDO. Creating a surrogate for CDO.DLL is necessary as dll files can not run by themselves, they have to be hosted in an executable process. J-Integra® for Exchange provides a tool called setdllhost.exe which can create an executable process/surrogate that will host CDO.DLL. Setdllhost.exe is located in the C:\jintegra\bin folder and should be run as follows:

    setdllhost CDO.DLL "CDO Surrogate"

    setdllhost accepts 2 parameters: [dll file] and a [surrogate name]. In the above example, we are creating a surrogate for CDO.DLL and calling this surrogate "CDO Surrogate". Make sure to run setdllhost.exe on the folder where CDO.DLL is located. To remove "CDO Surrogate", run as follows:

    setdllhost /unregister "CDO Surrogate"

  7. Configure the DCOM settings for the CDO surrogate so that it can be accessed remotely. To do this, open a command prompt and run dcomcnfg.

  8. The main DCOMCNFG window varies depending on the version of Windows operating system you are running. The following steps are applicable to Windows 2000 or earlier verions. If you are using Windows XP or Windows Server 2003, click Start, click Programs, click Administrative Tools, click Component Services. Expand Component Services, expand Computers, and right-click My Computer. Select Properties.

    6.1 On the pop up window, click on the Default Properties tab and put a check mark on Enable Distribute COM on this computer. Choose Connect as the Default Authentication Level and Impersonate as the Default Impersonation Level. Click on Apply.

    6.2 Click on the Applications tab, choose CDO Surrogate and click on Properties.

    On Windows XP or Windows Server 2003, expand Component Services, expand Computers, expand My Computer, and click DCOM Config. Right-click on the application you wish to configure. Select Properties.

    6.3 Under the General tab, set the Authentication Level to Connect

    6.4 Click on the Security tab. Select "Use custom access permissions" then click on Edit. From the Registry Value Permissions window, add the Java-Exchange user account you created in step 1. In the example below, this user account is "John Doe".

    6.5 Still on the Security tab, select "Use custom launch permissions" then click on Edit. Add the Java-Exchange user to the list, just as you did in the previous step. Click on Apply.

    6.6 On the Identity tab, select This user and input the credentials of the Java-Exchange user. Make sure that you enter the correct values. The safest way to do this is to use the Browse button to select the Java-Exchange user. In the example below, our Java-Exchange user - jdoe - belongs to the ROYLIM domain.
    Note: This account must have local administrative rights to the CDO machine.

Congratulations! You have finished configuring CDO. Now, let's run your first Java-to-Exchange application.