OL2000: Incorrect Start Dates for Shared Recurring Appointments

ID: Q232534


The information in this article applies to:
  • Microsoft Outlook 2000


SYMPTOMS

You programmatically retrieve recurring appointments from someone else's calendar using the Outlook object model, and the start dates for all of the recurring appointments are the same.


CAUSE

The person did not give you full permissions to their Calendar folder

-and-

In your code, you used early binding on the AppointmentItem object variable.


RESOLUTION

Late bind the AppointmentItem object variable. An example is provided after the "Steps to Reproduce Problem" section.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

The problem does not occur in Visual Basic Scripting Edition (VBScript) since all variables are inherently late-bound. However, this problem can occur if you use Outlook Visual Basic for Applications or automate Outlook from another application that supports early binding.

This problem did not occur in Microsoft Outlook 97 and was introduced in Outlook 98 (8.5). The problem was fixed in later versions of Outlook 98, but for the correct start times to be returned, you must use early binding of the AppointmentItem object variable.

With respect to this problem, no changes have been made to Outlook 2000, which still requires the AppointmentItem variable to be late-bound.

Steps to Reproduce Problem

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp
  1. Create a new recurring appointment in someone else's calendar. Do not use a second account you may have on the Microsoft Exchange Server. The other calendar must be on a computer with completely different Exchange or Microsoft Windows NT logon.


  2. Set the Subject of the appointment to test recur.


  3. Right-click the Calendar folder, and then click Properties. Click the Permissions tab, and give yourself Reviewer permissions.


  4. On your computer, run the following Visual Basic or Visual Basic for Applications automation code after setting a reference to the Microsoft Outlook 9.0 Object Library:


  5. 
    Sub TestRecur()
       Dim Recip As Outlook.Recipient
       Dim fldr As Outlook.MAPIFolder
       Dim CalItems As Outlook.Items
       Dim ResItems As Outlook.Items
       Dim Appt As Outlook.AppointmentItem
             
       Set ol = New Outlook.Application
       Set olns = ol.GetNamespace("MAPI")
       ' Change "emailname" to the other person's e-mail name.
       Set Recip = olns.CreateRecipient("emailname")
       Set fldr = olns.GetSharedDefaultFolder(Recip, olFolderCalendar)
       Set CalItems = fldr.Items
       CalItems.Sort "[Start]"
       CalItems.IncludeRecurrences = True
       Set ResItems = CalItems.Restrict("[Subject] = 'test recur'")
       For Each Appt In ResItems
          Debug.Print Appt.Start
       Next
    End Sub 
  6. Display the Immediate Window in the Visual Basic editor.


To have the above code return the correct start times for recurring appointments, change the following line of code

Dim Appt As Outlook.AppointmentItem 
to

Dim Appt As Object 
so that the Appt variable is late-bound.


REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

Q146636 OL2000: Questions About Custom Forms and Outlook Solutions

Additional query words: OutSol OutSol2000

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.