none
How to get recurring appointment current date?

    Question

  • Hi,

    I am trying to get the appointment current start time from a recurring appointment

    Instead of getting the current start time of this instance I am receiving the date of its creation.

    Can someone please tell me how to retrieve this field?

    Obj.Start would not work

    Tanks,

    Patrick

    Friday, April 13, 2012 10:25 AM

Answers

  • keep somewhere info about each appointmentmaster entry id, list of original dates for exceptions and last modification time for exceptions and master item. Each time item change event fires, check by using lastmodificationtime if item changed since your last synchronization and iterate through exceptions checking both last modification times to do the same and also original date to determine if new exception have shown up to process.
    • Marked as answer by Patrick12_3 Tuesday, April 17, 2012 12:37 PM
    Tuesday, April 17, 2012 11:50 AM

All replies

  • how do you obtain single occurances in recurrence meeting? If i do Item.IncludeRecurrences = true; and access single occurances then Start property shows proper datetime.
    Friday, April 13, 2012 10:48 AM
  • Hi Damian, tank you for replaying

    I did exactly what you did and still getting creation date and not proper date

    Please look at snippet:

     Dim Filter As String
     Dim oFolder As Outlook.MAPIFolder
    Dim CalendarItem As Outlook.Items
    Dim outlookNamespaceas As Outlook.NameSpace
    Dim obj As Outlook.AppointmentItem
    outlookNamespaceas = Globals.ThisAddIn.Application.Session
     oFolder = outlookNamespaceas.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
    ThisAddIn.ReleaseComObject(outlookNamespaceas)
    Filter = String.Format("[Start] >= '{0}' ,Today.ToString("g"))
     
    CalendarItem = oFolder.Items.Restrict(Filter)
    CalendarItem.IncludeRecurrences = True       
     For i = 1 To CalendarItem.Count
      obj = CalendarItem.Item(i)
               
      Dim StartTime As Date = obj.Start
      Dim EndTime As Date = obj.End
                       
    End For    

    Moreover i have encountered another strange thing when i remove

    CalendarItem.IncludeRecurrences = True

    i still gets the recurrence meeting way is that?

    Tanks,

    Patrick


    • Edited by Patrick12_3 Friday, April 13, 2012 11:50 AM
    Friday, April 13, 2012 11:23 AM
  • Add call to Sort on CalendarItem after IncludeRecurrences

    Friday, April 13, 2012 12:08 PM
  • Hi

    Still the same i get the creation date!

    Maybe it is a different problem way am i getting the recurrence appointment if i use this line?

    CalendarItem.IncludeRecurrences = false

    Maybe this is the problem?

    outlookNamespaceas = Globals.ThisAddIn.Application.Session


    • Edited by Patrick12_3 Friday, April 13, 2012 12:42 PM
    Friday, April 13, 2012 12:41 PM
  • try code with includerecurrences but wothout restrict, only sort - if you get still the same error, install outlookspy and select single occurence in calendar view, then click Item in spy's menu and see Start property.
    Friday, April 13, 2012 12:59 PM
  • Hi Damian,

    I did the following:

    Using includerecurrences without restrict, it skip all the single instances of the occurrence items and show me in the msgbox only the first one (the creation one)

     CalendarItem = oFolder.Items
    CalendarItem.IncludeRecurrences = True
    CalendarItem.Sort("[Start]", True)
    For Each obj1 In CalendarItem
    Try
    MsgBox(obj1.Location + " " + obj1.Start.ToString + " " + obj1.End.ToString)
    Catch ex As Exception
    End Try
    Next

    Looking at OutlookSpy it gives me the CORRECT time of the single occurrence

    Using the CalendarItem = oFolder.Items

    With or without restrict list only the creation occurrence Item! is there a way to prevent that?

    Friday, April 13, 2012 1:49 PM
  • ususally the problem you describe is when you call IncludeRecurrences without calling sort right afterwards.

    Try creating recurring meeting (for example for 3 consecutive days) and call your code as above - is only master item of created series returned? or all 3 items?

    Friday, April 13, 2012 2:24 PM
  • Strange thing when using CalendarItem.Sort("[Start]", true)

    It returns me only the master item

    But when using CalendarItem.Sort("[Start]", False)

    It list all the single items do you know how to bypass this problem?

    Friday, April 13, 2012 2:36 PM
  • i can reproduce your issue with boolean flag in sorting. I have not heard about such issue before, maybe someone more experienced could chime in on this. As for your particular problem - use flag version that returns all items and simply iterate from other side, is that ok for you?

    Friday, April 13, 2012 2:52 PM
  •  

    Hi Damian,

    Tank you for your help I appreciate it very much, this is really strange problem.

    I think I will check if the appointment is recurring and add the number of days from the master Recurrences till today that way iterate on fewer Items.

    maybe it best to keep the post open to see if someone can solve this bug after all ?

     

    best regards 

    patrick

    Friday, April 13, 2012 3:19 PM
  • it is somewhat strange, anyway, i would not use Restrict with filter that changes every day, since exchange caches restrictions for about a week, so this could be taxing on server. Maybe tell us what you want to do with information from events and we will find simpler way to achieve this.
    Friday, April 13, 2012 6:23 PM
  • Hi, Damian

    i need to add information to appointments for every appointment that the user receive i need to check if  a similar appointment already exist (similar message or location or new User Property status as Boolean) in the user machine and if so change the new appointment status according to the old one or change both appointments status according to user choosing (i prompt a form)

    For that i need appointment EntryID and its other fields. and it is best to iterate on less appointments so i use

    restrict [Start>]= today that way iterate on less appointments ...

    But you said something about exchange caches restrictions for about a week, WHAT DOES THAT MEAN? Every time ? or just the last time using restrict ? and cleans the old catch?

    the user will receive appointment or create ones for more than once a day what to do?

    What about create Table?

    I have another Q I found the set column function CalendarItem.SetColumns

    It catches the appointment fields thus can iterate on appointments without opening them it is much faster. The problem is that the field EntryID, conflict is not supported Is there another way?

    Tanks,

    Patrick

    Saturday, April 14, 2012 8:29 AM
  •  

    Hi, Damian

    i am receiving strange things with th IncludeRecurrences CalendarItem.Count is more than 200000 items :)

    Do you know way i am getting so much items? maybe it is because Recurrence item i have no end time?

    Tanks,

    Patrick

            CalendarItem = oFolder.Items.Restrict(Filter)
             CalendarItem.IncludeRecurrences = True
             CalendarItem.Sort("[Start]")

    Saturday, April 14, 2012 11:56 AM
  • The filter needs to specify both the start and end times.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Saturday, April 14, 2012 4:00 PM
  • Hi Dmitry,

    I receive Recurrences appointments even if I write

    CalendarItem.IncludeRecurrences = False

    CalendarItem.Sort("[Start]")

    how that could be?

     

    I looked at OutlookSpy at some single recurring meetings all the requiring Items has the same EntryID as the master item is that correct or a bug? how can i get the single Item's EntryID?

    Can you please tell me way using

    CalendarItem.Sort("[Start]", true)

    returns only the master item

    But when using CalendarItem.Sort("[Start]", False)

    It list all the single items?

    Appreciate it

    Patrick

    Saturday, April 14, 2012 4:57 PM
  •  

    I tried using your suggestion about specifying both the start and end times. i have zero recurring meetings in outlook but i receive a huge number of items. Can you please look at the code bellow?

     Dim Filter As String
                Dim oFolder As Outlook.MAPIFolder
                Dim CalendarItem As Outlook.Items
                Dim outlookNamespaceas As Outlook.NameSpace
                outlookNamespaceas = Globals.ThisAddIn.Application.Session
                oFolder = outlookNamespaceas.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
                ThisAddIn.ReleaseComObject(outlookNamespaceas)
                Filter = String.Format("[Start] >= '{0}' AND [Start] <= '{1}'", Today.ToString("g"), Today.AddDays(1).ToString("g"))
                CalendarItem = oFolder.Items.Restrict(Filter)
                ThisAddIn.ReleaseComObject(oFolder)
                CalendarItem.IncludeRecurrences = True
                CalendarItem.Sort("[Start]", False)
                MsgBox(CalendarItem.Count)
                ThisAddIn.ReleaseComObject(CalendarItem)
                Filter = Nothing

    Saturday, April 14, 2012 5:32 PM
  • You are doing it in the wrong order - set IncludeRecurrences , call Sort, *then* call Restrict:

                CalendarItem = oFolder.Items
                CalendarItem.IncludeRecurrences = True
                CalendarItem.Sort("[Start]", False)
                CalendarItem = CalendarItem.Restrict(Filter)
                MsgBox(CalendarItem.Count)


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Saturday, April 14, 2012 5:40 PM
  • Hi,

    it still does not work

     Dim Filter As String
                Dim oFolder As Outlook.MAPIFolder
                Dim CalendarItem As Outlook.Items
                Dim outlookNamespaceas As Outlook.NameSpace
                outlookNamespaceas = Globals.ThisAddIn.Application.Session
                oFolder = outlookNamespaceas.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar)
                ThisAddIn.ReleaseComObject(outlookNamespaceas)
       
                Filter = String.Format("[Start] >= '{0}' AND [End] <= '{1}'", Today.ToString("g"), Today.AddDays(2).ToString("g"))
                CalendarItem = oFolder.Items
                CalendarItem.IncludeRecurrences = True
                CalendarItem.Sort("[Start]", False)
                CalendarItem = CalendarItem.Restrict(Filter)
                MsgBox(CalendarItem.Count)
                ThisAddIn.ReleaseComObject(oFolder)
                ThisAddIn.ReleaseComObject(CalendarItem)

    Saturday, April 14, 2012 5:50 PM
  • Sort needs to be called with the second parameter True:

    strFilter = "[Start] >= '2012-04-08' AND [End] <= '2012-04-12'"
    set CalendarItem = Application.ActiveExplorer.CurrentFolder.Items
    CalendarItem.IncludeRecurrences = True
    CalendarItem.Sort "[Start]", true
    set CalendarItem = CalendarItem.Restrict(strFilter)
    MsgBox CalendarItem.Count
    for each item in CalendarItem
      Debug.Print item.Subject & " " & item.Start
    next


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Saturday, April 14, 2012 5:58 PM
  • Hi Dmitry,

     

    I appreciate your help!!

    "Sort needs to be called with the second parameter True:"

    returns just the Parent Item and not his children.

     

    call sort with false

    Returns a bug - a huge number of Items but returns the children. Can you please check it?

    it is strange that we get different results..

     Filter = String.Format("[Start] > '{0}' AND [Start] < '{1}'", Today.ToString("g"), Today.AddDays(5).ToString("g"))
    '  CalendarItem = Application.ActiveExplorer.CurrentFolder.Items
     CalendarItem = oFolder.Items
    CalendarItem.IncludeRecurrences = True
    CalendarItem.Sort("[Start]", False)
    CalendarItem = CalendarItem.Restrict(Filter)
    MsgBox(CalendarItem.Count)
    For Each b In CalendarItem
    If b Is Nothing Then
    Exit For
    End If
    MsgBox(b.Start.ToString)
    Next

    Saturday, April 14, 2012 6:15 PM
  • I am sorry, this is weekend, but I still half asleep :-)

    The second parameter must be false, but you should not be accessing Items.Count because Outlook does not calculate the number of items in advance; you need to loop through all items using "foreach":

    strFilter = "[Start] >= '4/8/2012' AND [Start] <= '4/14/2012'"
    set CalendarItem = Application.ActiveExplorer.CurrentFolder.Items
    CalendarItem.IncludeRecurrences = True
    CalendarItem.Sort "[Start]", false
    set CalendarItem = CalendarItem.Restrict(strFilter)
    for each item in CalendarItem
      Debug.Print item.Subject & " " & item.Start
    next


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Saturday, April 14, 2012 6:29 PM
  • Hi Dmitry,

    Tank you for your help, sorry to wake you :)  the restrict issue is very problematic

    I have some more Q about this subject

    I don’t want to wake you so let’s talk tomorrow OK?

    Best regards,

    Patrick

    Saturday, April 14, 2012 6:43 PM
  • Hi Dmitry,

    I have some problems with restrict and with IncludeRecurrences

    And I was wondering if you can help me? I get strange results when using

    IncludeRecurrences  = true and without using it.

    For this example please make a Recurrence appointment for every Monday and a different

    Appointment on 18/04/2012

    When using this code I receive 2 appointments the appointment on 18/04/2012 and the Recurrence appointment on Monday while I should receive only the on in 18/04/2012 can you please explain this to me?

    Recurrence appointment is not in the interval at all

    Dim StartDate As Date = CDate("18/04/2012 00:00")
                Dim EndDate As Date = CDate("18/04/2012 15:00")
                Filter = String.Format("[Start] < '{0}' AND [End] >= '{1}'", EndDate.ToString("g"), StartDate.ToString("g"))
                '  CalendarItem = Application.ActiveExplorer.CurrentFolder.Items
                CalendarItem = oFolder.Items
                ' CalendarItem.IncludeRecurrences = True
                ' CalendarItem.Sort("[Start]", False)
                CalendarItem = CalendarItem.Restrict(Filter)
                MsgBox(CalendarItem.Count)
                Dim EntryIDstr As String
                For Each b In CalendarItem
                    If b Is Nothing = False Then
                        MsgBox(b.Start.ToString)
                    End If
                Next

     

    And when using this code i receive both appointment while the Recurrence appointment is not in the interval at all

    Dim StartDate As Date = CDate("18/04/2012 00:00") Dim EndDate As Date = CDate("18/04/2012 15:00") Filter = String.Format("[Start] < '{0}' AND [End] >= '{1}'", EndDate.ToString("g"), StartDate.ToString("g")) ' CalendarItem = Application.ActiveExplorer.CurrentFolder.Items CalendarItem = oFolder.Items CalendarItem.IncludeRecurrences = True CalendarItem.Sort("[Start]", False) CalendarItem = CalendarItem.Restrict(Filter) ' till here all is good

    ''''cant sort by End ?? CalendarItem.Sort("[End]") ''''''''' MsgBox(CalendarItem.Count) Dim EntryIDstr As String For Each b In CalendarItem If b Is Nothing = False Then MsgBox(b.Start.ToString) End If Next

     what about releasing com object? Problem with for each loop??

    I appreciate your help

    patrick

    Sunday, April 15, 2012 7:06 AM
  • The restriction does not make much sense - you are asking for all appointments that start before 18/4/2012 00:00 but end after 18/4/2012 15:00.
    

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, April 16, 2012 6:00 AM
  • Hi,

    I am asking for all the appointments that start before 18/4/2012 15:00. And end > 18/4/2012 00:00

    This appointment falls into the criteria: Start: 17/4/2012 23:00 , End : 18/4/2012 02:00

    Another problem is that the search doesn’t work with UserProperty. It gives me only the Parent Recurrences Item

    Filter = String.Format("[Start] < '{0}' AND [End] >= '{1}' AND [MyUserPrpperty] = False", StartTime.ToString("g"), LowerDate.ToString("g"))
            CalendarItem = oFolder.Items
            ThisAddIn.ReleaseComObject(oFolder)
            CalendarItem.IncludeRecurrences = True
            CalendarItem.Sort("[Start]", False)
            CalendarItem = CalendarItem.Restrict(Filter)

    Monday, April 16, 2012 8:28 AM
  • as for user property - are you sure it is added on Folder level? check with Folder.UserDefinedProperties, if it is there.
    Monday, April 16, 2012 10:56 AM
  • Hi,

    it is listed the code show the Property Name

     For Each s In oFolder.UserDefinedProperties
                MsgBox(s.Name)
            Next


    • Edited by Patrick12_3 Monday, April 16, 2012 11:27 AM
    Monday, April 16, 2012 11:20 AM
  • Hi Damian,

    is there a way to get the Child Recurrence Item EntryID?

    outlookSpy shows that all the children have the same EntryID as the Parent.

    Patrick

    Monday, April 16, 2012 11:27 AM
  • ok, and did you verify with OutlookSpy or in some other way (for example print preview) that specific occurances do have that property set? remember that you are checking for specific value of property so items that do not have that property at all will not be returned in resultset.
    Monday, April 16, 2012 11:27 AM
  • Yes this code says that it is ok

    meaning that i can read the property Value from the Item

     Filter = String.Format("[Start] < '{0}' AND [End] >= '{1}'", StartTime.ToString("g"), LowerDate.ToString("g"))
            CalendarItem = oFolder.Items
            ThisAddIn.ReleaseComObject(oFolder)
            CalendarItem.IncludeRecurrences = True
            CalendarItem.Sort("[Start]", False)
            CalendarItem = CalendarItem.Restrict(Filter)
            For Each Item In CalendarItem
                If Item Is Nothing = False Then
                    If Item.Start < StartTime And Item.End >= LowerDate Then
                        Uproperty = Item.UserProperties.Find("MyUserProperty")
                        If Uproperty Is Nothing = False Then
                            If Uproperty.Value = False Then
                                If Item.End > MaxDate Then
                                    'the Item get to here so the property exist
                                    MaxDate = Item.End
                                    Appointment.AppointmentStartTime = Item.Start
                                    Appointment.AppointmentEndTime = Item.End
                                    Appointment.AppointmentEntryID = Item.EntryID
                                End If
                            End If
                            ThisAddIn.ReleaseComObject(Uproperty)
                        End If
                    End If
                End If
                ' ThisAddIn.ReleaseComObject(Item)
            Next

    Monday, April 16, 2012 11:42 AM
  •  

    Is there any rules of filtering items that include Recurrence and UserProperty?

    What about the EntryID of the Child Recurrence? i am attempting to get a single one by his EntryID but I cant do that

    Because all the Items as simillar EntryId's

    Monday, April 16, 2012 11:48 AM
  • this is by design - when you create recurring appointment only single master item is created - as long as you do not modify anything on any single occurence that would cause to create exceptions there are no separate items corresponding to separate occurences. As for verification of user property on single exception - open it from UI (choosing open this occurence) and look at print preview - is your user property there?
    Monday, April 16, 2012 12:08 PM
  • yes it is there, strange dont you think?
    Monday, April 16, 2012 12:14 PM
  • i was too quick to assume it will work as with normal items - apparently for appointmentitems user properties from exceptions are overriden by master item ones with print preview and possibly also with searching as i could not search by user property on exception item. So i guess you should stick to filtering only by date and check user properties manually.

    Monday, April 16, 2012 1:26 PM
  • Hi, Damian, Tanks for your help.

     

    how can i release the com object when iterating an all object by for each loop, i need to use that because

    When using CalendarItem.IncludeRecurrences = True CalendarItem.Count shows a huge number but there are only few Items in CalendarItem, so i can’t trust the regular for loop

    Is that ok?

    for each s in CalendarItem
    ' do something
    System.Runtime.InteropServices.Marshal.ReleaseComObject(s)
    end for

    Monday, April 16, 2012 1:43 PM
  • as i see it - you have no choice but to release it that way, remember to also release CalendarItem after you finish looping. Maybe you could consider using Find/FindNext on CalendarItem untill it returns null? i have not tried it myself, though.

    Monday, April 16, 2012 2:02 PM
  • Tank you Damian for all your help

    patrick

    Monday, April 16, 2012 2:20 PM
  • Individual recurrence items don't actually exist at all, unless they are exceptions in the Exceptions collection. The parent item (master appointment) has the RecurrencePattern and Exceptions collection.

    To find a specific occurrence you use the GetOccurrence() method of the RecurrencePattern object and supply the date you want. If the item isn't found that way you go to the Exceptions collection and iterate it to find an item where the OriginalDate property matches the date you want.


    Ken Slovak MVP - Outlook

    Monday, April 16, 2012 6:42 PM
  • Hi Ken tank for your replay.

    This is exactly what I am doing now but I have a problem with the date.

    when Item change event is fireing I recive the master Item and dont know how to get the Start time of the Child Item that moved

    Exceptions don’t give me the last Item that changed only the list of Items that don’t match

    the Master Item anymore

    do you know how to solve this?

    Patrick

        Public Sub ChangedAppointment(ByVal Item As Object) Handles CalendarItemEvent.ItemChange
            If Item.IsRecurring Then
                Dim myRecurrPatt As Outlook.RecurrencePattern
                Dim myException As Outlook.Exception
                myRecurrPatt = H.GetRecurrencePattern()
                ' ‘How to get the Start of this single Item?
                myException = myRecurrPatt.GetOccurrence(???)
                'or iterate on Exceptions
                For Each e In myRecurrPatt.Exceptions
                    ' I need to know the date + time of current item to find him..Exceptions don’t give me the last
                    'Item that changed only the list of Items that don’t match the Master Item anymore
                Next
            End If
        End Sub



    Monday, April 16, 2012 9:28 PM
  • i have not tried this myself but i guess that when you move single occurence to new date (which implicitly creates exception) you will get 2 item change events (or more) - one for master item (maybe exceptions collection is updated) and one for newly created exception. So i would wait for item change on this new exception and find matching exception in master item using code like this:

    AppointmentItem exceptionItem

    AppointmentItem masterItem

    foreach(exception exc in masterItem.Exceptions)

    {

    if(exc.AppointmentItem == exceptionItem)//this is the one

    }

    of course remember to use for, not foreach, i used it for tersness of code sample

    Tuesday, April 17, 2012 7:35 AM
  • Hi Damian,

     

    this is exactly the problem i can find the exaction Item that Updated i only get the Master Item

    the change event is for oFolder.Items is there an Exceptions changed event for the Exceptions list of each Master Item?

    for getting the exceptionItem i need AppointmentItem = myRecurrPatt.GetOccurrence(???)

    But the date is only the Master Item date

    What do you think about iterating on a container that contains all the Exceptions?

    and if one of them don’t mach than he is the one that changed?

    (i am trying to avoid iterating the best way is to get the date for the GetOccurrence Method)


      

    // this is what i am looking for the single exceptionItem Item

    AppointmentItem exceptionItem

    // when appointment change event is firing i get the master item AppointmentItem masterItem foreach(exception exc in masterItem.Exceptions) {

    // the exceptionItem is missing if(exc.AppointmentItem == exceptionItem)//this is the one }


    Tuesday, April 17, 2012 8:33 AM
  • Holding onto AppointmentItems and Exceptions for longer then necessary is surest way for strange errors and event stranger dialog boxes from outlook when working with calendar from UI, so do not do it.

    To my suprise, when exception is created (which means new item is created in calendar's item), only Item_Change on master is raised, no item_add (as you of course described above). So going somewhat with what you want - if you need to determine if new exception appeared for particular master item store somewhere (file, hidden message, user property, etc.) Dictionary of EntryId => list of original dates from exceptions (Exception.OriginalDate) then you can iterate through exceptions in master item and determine by checking OriginalDate if new exception appeared.

    Tuesday, April 17, 2012 9:53 AM
  • Hi Damian,

    Look at the scenario that i describe.

    Create new recurring appointment for every day at 9:00

    And change a single Item to start at 10:00

    And run the code.

    For Each myException In myRecurrPatt.Exceptions
     If myException Is Nothing = False Then
    MsgBox(myException.OriginalDate.ToString("g") + " " + myException.AppointmentItem.Start.ToString("g"))
    End If
    Next 

    This loop will give you to dates on at 9:00 and one at 10:00

    Now move the sane single item to 11:00 and you will get to dates one at 9:00 and one at 11:00

    So the OriginalDate don’t get update ... moreover if only the subject is being changed?

    from your previous post we need to check if the Item really changed.

    I created a new event for before Item move in oFolder

    Private Sub objCalFolder_BeforeItemMove(ByVal Item As Object, ByVal MoveTo As Outlook.MAPIFolder, ByRef Cancel As Boolean) Handles objCalFolder.BeforeItemMove Try If ThisAddIn.AppointmentRef.IsRecurring = False Then ThisAddIn.ReleaseComObject(Item) Else ' puclic shared as outlook.appointmentItem ThisAddIn.AppointmentRef = Item ThisAddIn.AppointmentStartBeforChanged = Item.start

    End If ThisAddIn.ReleaseComObject(UserProp) ThisAddIn.ReleaseComObject(MoveTo) Catch ex As Exception MsgBox(ex.Message + " objCalFolder_BeforeItemMove") End Try End Sub

    Now in my Item changed Event it gives me the correct time of the single Item this is the Exception.

     MsgBox(ThisAddIn.AppointmentRef.Start)
     ThisAddIn.ReleaseComObject(ThisAddIn.AppointmentRef)


     

    Now Iterate on container with all fields necessary before release

    dim changed as boolean = container(ThisAddIn.AppointmentStartBeforChanged ,ThisAddIn.AppointmentRef.Start,ThisAddIn.AppointmentRef.End,ThisAddIn.AppointmentRef.EntryID,ThisAddIn.AppointmentRef.Subject

    I need to check this code let's say in 5 hours i will start OK?

    Patrick



    • Edited by Patrick12_3 Tuesday, April 17, 2012 10:56 AM
    Tuesday, April 17, 2012 10:53 AM
  • original date never update - this is the only way to determine for what original date this exception is for - since it could have been moved around few times after initial creation of exception. That is why this property is suitable for determining if you already have this exception in your cachce (already hnadled it). And if you want to determine if you need to process _again_ particular exception, check its LastModificationDate (and also store it).

    I;m not fond of your approach above - you store appointmentitem for checking against it later - as i said, this is asking for trouble like discarded changes, etc. Rememebr that you should check at least scenarios shown below:

    1. single occurence dragged and dropped into new timeslot

    2. single occurence opened in inspector and new date entered there

    3. new recurrence pattern entered into master item which causes all exceptions to be deleted

    Tuesday, April 17, 2012 11:12 AM
  • This is problematic,

    Let me remain you of my problem,

    I need to check Local DB with 2 million rows every time an appointment changes.

    Because Outlook appointment item is a data type outlook synchronizes and raises the Item change event whenever he likes. Even if an appointment have not been changed.

    I need to avoid searching DB if it is not necessary, I understood that the only way doing so is to keep a list of all appointments fields and before searching DB check if appointment changed or not…. (if something is different)

    On startup I fill the container (list of classes that contains strings..)

    And check when Item changed event is raised so what do you suggest if it is problematic?

    Tanks,

    Patrick

    Tuesday, April 17, 2012 11:44 AM
  • keep somewhere info about each appointmentmaster entry id, list of original dates for exceptions and last modification time for exceptions and master item. Each time item change event fires, check by using lastmodificationtime if item changed since your last synchronization and iterate through exceptions checking both last modification times to do the same and also original date to determine if new exception have shown up to process.
    • Marked as answer by Patrick12_3 Tuesday, April 17, 2012 12:37 PM
    Tuesday, April 17, 2012 11:50 AM
  • This is what I am doing i am constructing a list of appointment Info that should tell me if there is a change

    I don’t save reference just the Fields info and iterate and return a Boolean

    For each appointment or exaction I have its fields and can tell if there is a change

    I think I will divide the list one for regular Appointments and One for Exception info

    With last modification and more fields if necessary

    Do you have something to add?

    Tanks a lot Damian I truly appreciate your help and support

    Sincerely

    Patrick

    Tuesday, April 17, 2012 12:14 PM
  • no, that is all from my side. I would go only with last modification time to determine if something change, but your approach will also work.
    Tuesday, April 17, 2012 12:22 PM
  • Tanks
    Tuesday, April 17, 2012 12:37 PM
  • Patrick:

    Did you ever get a satisfactory answer?

    I have a related problem, but I am not a developer.  I was hoping that I could be directed to an add-in that does what you describe here. 

    Here's my issue:  I am an attorney that needs a good tickler system to alert me to one-time deadlines and recurring deadlines.  I want to see these deadlines in both a calendar view and a list view that I can sort by next occurrence.  Here's what I have found:

    While I can create a "Deadline" task list that will sort by "Due Date" providing me with the list described above that sorts all my one-time items and recurring items by the next occurrence, it cannot be viewed as a calendar - so no good.

    Creating a "Deadline" calendar allows me to view the items/appointments in a calendar view, and I can view these items/appointments in a list view, but I cannot sort the list as I want.  In the calendar list view, I can retrieve all calendar appointments that have not expired (including the recurring items) by filtering the "Start Date" for all dates after the current date.  However, if I try to sort the list by the "Start Date" field, I cannot sort the recurring items by the next appointment "Start Date" instead the "Start Date" field for recurring items is populated with the creation date.  I thought I'd be tricky and use the "Field Chooser" to pull in some of the task list fields into the calendar list view - specifically "Due Date" so that I could sort the items the same way that I can do in the task list.  But even if I add the "Due Date" field, the dates are not updated as they are updated in the task list because the "Recurrence" field in the task list that is used to update the due dates for tasks is not the same as the "Recurrence" field in the calendar items.  And even if I use the field chooser to pull in the task list "Recurrence" field, I can't find a way to update these new fields....

    Logically, it seems that an add-in could be created to make the Outlook tickler system I envision by doing any one of the following (1) showing the next occurrence date rather than the creation date in the calendar "Start Date" field - which is clearly picked up by filtering, (2) allowing the user to alter the task list "Recurrence" field data for calendar items so that the "Due Date" field can update to the next occurrence/appointment, or (3) allowing a calendar view for task lists.

    Any suggestions?

    -JLoomis

       

        

     

    Thursday, December 20, 2012 7:31 PM