OL2000: Incorrect Start Dates for Shared Recurring Appointments (232534)
The information in this article applies to:
- Microsoft Outlook 2002
- Microsoft Outlook 2000
This article was previously published under Q232534 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.
NOTE: The properties that are read may also effect results, see the note at the end of the "More Information" section.
RESOLUTION
Late bind the AppointmentItem object variable. An example is provided after the "Steps to Reproduce Problem" section.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are 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 ProblemMicrosoft 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 Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
- 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.
- Set the Subject of the appointment to test recur.
- Right-click the Calendar folder, and then click Properties. Click the Permissions tab, and give yourself Reviewer permissions.
- 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:
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
- 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
Dim Appt As Object
so that the Appt variable is late-bound. NOTE: You may also experience the problem when you refer to the properties of the parent series (such as AllDayEvent) rather than to the properties of each occurrence (Subject, Start, End).
In this situation and if you need to refer to parent series properties, do the following: After you access the occurrence properties, set a separate early-bound object variable to the late-bound object in the code sample above. Refer to series properties from the second early-bound object variable.
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: 146636 OL2000: Questions About Custom Forms and Outlook Solutions
Modification Type: | Major | Last Reviewed: | 5/20/2003 |
---|
Keywords: | kbbug kbProgramming KB232534 |
---|
|