Condividi tramite


DST: CDO 1.21 issue related to having Outlook installed on Exchange Server

SYMPTOMS:

========================

I recently assisted with a CDO 1.21 DST related issue where custom date field values set programmatically with CDO 1.21 (after the DST change on 3/11) were off by 1 hour. The CDO 1.21 code was running in a Scripting Agent on an Exchange 5.5 Server that had all of the DST updates installed.

 

We could see that the correct DST build of CDO.DLL was in the System32 directory, and by searching HKCR for “MAPI.Session” we found the CLSID for CDO 1.21 and confirmed that our InProcServer32 value was pointing to the correct build of CDO.DLL.

 

But the problem still happened and was easily reproducible with a test user by running the simple CDO 1.21 sample code below from VB6. To see the incorrect date value we would login to Outlook on a client machine as the same test user and add our test date field “DateTest” to the current view using Outlook’s Field Chooser. Once added, we could see that the value of our custom Date field was off by 1 hour.

 

Sample CDO 1.21 code to create and populate an Outlook date property:

-------------------------------------------------------------------------------------------------

Sub CDO_AddTestUserProperty()

Dim objSession As MAPI.Session
Dim objMessage As MAPI.Message
Dim oFields As MAPI.Fields
Const CdoPropSetID = "2903020000000000C000000000000046"

Set objSession = New MAPI.Session
objSession.Logon , , , True, , , "MyExServer" & vbLf & "testuser@address.com"

'Get the most recent item in the Inbox of testuser
Set objMessage = objSession.Inbox.Messages.GetLast
Set oFields = objMessage.Fields

Dim dateFieldValue As Date
strFieldName = "DateTest"
dateFieldValue = Now()
Debug.Print dateFieldValue

Set oField = oFields.Add(strFieldName, vbDate, dateFieldValue, CdoPropSetID)
objMessage.Update

Set oField = Nothing
Set oFields = Nothing
Set objMessage = Nothing
objSession.Logoff
Set objSession = Nothing

End Sub

 

PROBLEM:

===============================

It turned out that Outlook 2000 was installed on this Exchange 5.5 server (which is a bad idea) and the un-patched Outlook build of CDO.DLL kept being loaded instead of the patched version for Exchange. 

 

 

RESOLUTION:

===============================

We were able to resolve the immediate issue by following these steps:

1. Uninstall Outlook’s Collaboration Data Objects component.

1. Make sure Outlook is closed on the server

2. Control Panel --> Add or Remove Programs

3. Select your install of Office/Outlook (i.e. “Microsoft Office 2000” or “Microsoft Outlook 2000”)

4. Click “Change”

5. Click “Add or Remove Features”

6. Expand the list of components under “Microsoft Outlook for Windows”

7. Click on the down arrow next to “Collaboration Data Objects”

8. Select “Not Available” (it should appear as a red X)

9. Click “Update Now” and complete the steps.

2. Re-register the correct version of CDO.DLL in the System32 directory using Regsvr32.exe.

 

 

For some other CDO 1.21 DST related issues see: FYI: DST 2007 exposes those who misuse CDO 1.21

Comments

  • Anonymous
    March 14, 2007
    Walter Warren, a fellow developer support engineer and Outlook dev guru has started blogging . He already