none
recurring appointments in other users calendar RRS feed

  • Question

  • Hi,

    I am trying to retrieve every appointment inside a specific time interval.

    I set the sorting to [Start] and 'IncludeRecurrences' to true and then I call the _Items.Restrict() method.

    When used on the calendar of the current user this works perfectly fine. The 'Start' and 'End' properties of recurring appointments that are returned have the correct value (that of the single ocurrence inside the specified time interval).

    But when used on the calendar of other users (to which the current user has read access) then the 'Start' and 'End' properties are those of the master appointment.

    I also noticed that when I open a recurring appointment from the UI I am being asked if I want to open the appointment series or the ocurrence. But when I open a recurring appointment from the calendar of another user it will always open the appointment series.

    So, is there any way to open a single ocurrence of a recurring appointment series in the calendar of another user? Or at least get the 'Start' and 'End' values of the ocurrences inside the time interval?

    Any help is appreciated.

    Friday, November 2, 2012 1:05 PM

Answers

  • I think the only way this would work correctly is if the calendar was another user's calendar in Exchange and you open that mailbox as part of your Outlook profile.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "2258654" <=?utf-8?B?MjI1ODY1NA==?=> wrote in message news:8f4f5212-594a-4a25-92e1-fb7c7b32c4fe...

    Hi Ken, hi DamianD,

    @Ken:

    GetOccurrence always returns an empty pointer (and no error) when called on a master appointment from the calendar of another user (even when gotten from the selection in the UI). It works fine on my own master appointments.

    @DamianD:

    I tried it as you suggested. I selected an appointment in the calendar of another user in the UI. In the code I took the selected appointment, got the parent (the calendar folder) and from there tried the Restrict method. Unfortunately with the same results.

    At some point Outlook has to use its 'calculation' engine since it does know that there is an occurrence inside the specified time interval. Only if there is an occurrence does it return the master appointment. Outlook just doesn't tell me which occurrence it is ;)

    Thank you both very much for your help so far.


    Ken Slovak MVP - Outlook
    • Marked as answer by 2258654 Tuesday, November 6, 2012 7:41 AM
    Monday, November 5, 2012 4:00 PM
    Moderator

All replies

  • If you're getting the master appointment, have you tried using the RecurrencePattern to retrieve indovidual instances of the series?
     
    How are those other calendars being opened?

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "2258654" <=?utf-8?B?MjI1ODY1NA==?=> wrote in message news:e85b3474-3d6c-4e7f-b4c6-474e475322c0...

    Hi,

    I am trying to retrieve every appointment inside a specific time interval.

    I set the sorting to [Start] and 'IncludeRecurrences' to true and then I call the _Items.Restrict() method.

    When used on the calendar of the current user this works perfectly fine. The 'Start' and 'End' properties of recurring appointments that are returned have the correct value (that of the single ocurrence inside the specified time interval).

    But when used on the calendar of other users (to which the current user has read access) then the 'Start' and 'End' properties are those of the master appointment.

    I also noticed that when I open a recurring appointment from the UI I am being asked if I want to open the appointment series or the ocurrence. But when I open a recurring appointment from the calendar of another user it will always open the appointment series.

    So, is there any way to open a single ocurrence of a recurring appointment series in the calendar of another user? Or at least get the 'Start' and 'End' values of the ocurrences inside the time interval?

    Any help is appreciated.


    Ken Slovak MVP - Outlook
    Friday, November 2, 2012 2:24 PM
    Moderator
  • Thank your for your answer.

    I have not yet tried using the recurrence pattern to open the individual ocurrences. My hope was being able to avoid this somehow, since it works fine with the current user's calendar. Why shouldn't it be the same with other calendars?

    I'll try it out and let you know how I fared.

    To open the calendar of another user I do the following (simplified for readability):

    GetCalendarByMail (Outlook::_NameSpace spSession_, BSTR bstrMail_, Outlook::MAPIFolder &rspCalendar_) {

    Outlook::Recipient spRecipient; spSession_->CreateRecipient(bstrMail_, &spRecipient); VARIANT_BOOL vbResolved = VARIANT_FALSE; spRecipient->Resolve(&vbResolved); if (vbResolved == VARIANT_TRUE) { spSession_->GetSharedDefaultFolder(spRecipient, Outlook::olFolderCalendar, &rspCalendar_); } }


    • Edited by 2258654 Friday, November 2, 2012 2:51 PM
    Friday, November 2, 2012 2:49 PM
  • Recurring appointments do not really exist as physical beings - only master item and exceptions, all others are 'virtual' and calculated by outlook. My guess is that for calendars opened in such way, outlook does not invoke its 'calculation' engine. try maybe fiddling a little with UI - open that calendar from UI and invoke your code then, maybe it will make it work?
    Monday, November 5, 2012 9:11 AM
  • Hi Ken, hi DamianD,

    @Ken:

    GetOccurrence always returns an empty pointer (and no error) when called on a master appointment from the calendar of another user (even when gotten from the selection in the UI). It works fine on my own master appointments.

    @DamianD:

    I tried it as you suggested. I selected an appointment in the calendar of another user in the UI. In the code I took the selected appointment, got the parent (the calendar folder) and from there tried the Restrict method. Unfortunately with the same results.

    At some point Outlook has to use its 'calculation' engine since it does know that there is an occurrence inside the specified time interval. Only if there is an occurrence does it return the master appointment. Outlook just doesn't tell me which occurrence it is ;)

    Thank you both very much for your help so far.

    Monday, November 5, 2012 12:57 PM
  • I think the only way this would work correctly is if the calendar was another user's calendar in Exchange and you open that mailbox as part of your Outlook profile.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "2258654" <=?utf-8?B?MjI1ODY1NA==?=> wrote in message news:8f4f5212-594a-4a25-92e1-fb7c7b32c4fe...

    Hi Ken, hi DamianD,

    @Ken:

    GetOccurrence always returns an empty pointer (and no error) when called on a master appointment from the calendar of another user (even when gotten from the selection in the UI). It works fine on my own master appointments.

    @DamianD:

    I tried it as you suggested. I selected an appointment in the calendar of another user in the UI. In the code I took the selected appointment, got the parent (the calendar folder) and from there tried the Restrict method. Unfortunately with the same results.

    At some point Outlook has to use its 'calculation' engine since it does know that there is an occurrence inside the specified time interval. Only if there is an occurrence does it return the master appointment. Outlook just doesn't tell me which occurrence it is ;)

    Thank you both very much for your help so far.


    Ken Slovak MVP - Outlook
    • Marked as answer by 2258654 Tuesday, November 6, 2012 7:41 AM
    Monday, November 5, 2012 4:00 PM
    Moderator
  • I would need access to that users mailbox then? Unfortunately that's not an option.

    I'll try using the recurrence pattern and exceptions to calculate the occurrences myself.

    Thank you both for your help.

    Tuesday, November 6, 2012 7:40 AM