none
C#+Outlook 2010: Is there any way to programmatically sync meeting responses received in Inbox as soon as it lands in Inbox? RRS feed

  • Question

  • Hello,

    I am working on a requirement where I need to find if all attendees declined the original meeting. This logic need to be run as soon as an attendee response lands in Inbox [other responses on the way].

    So for every response my logic kicks in and try to determine if all attendees of original meeting declined the meeting using MeetingResponseStatus attribute of each recipient.

    But I observed that this logic does not work properly all the time and sometimes i observed that even though all declined responses landed in Inbox, probably tracking is not updated properly with all responses yet and so my logic still returns me few participants.

    This might be an expected behavior of Outlook. Anybody knows if this is expected? If it is expected, how to handle this situation where i would like to determine if all attendees declined meeting as soon as responses lands in Inbox folder of Organizer.

    Do I need to delay my processing a few milliseconds and let Outlook sync these responses to tracking first and then check

    MeetingResponseStatus attribute of each recipient? How much time it might take to sync such details after response lands in Inbox?

    Here is my sample code to check attendee responses:

    outlook.Recipient extRecipientObj = aItem.Recipients.Cast<outlook.Recipient>().FirstOrDefault(o =>(o.Resolve() && o.AddressEntry.Type == "SMTP") && (o.MeetingResponseStatus != outlook.OlResponseStatus.olResponseDeclined) && !o.Address.Equals(x500Address, StringComparison.CurrentCultureIgnoreCase));

    here x500Address is an Address of attendee whose decline response is received in Inbox and we started processing.

    Above code line returns if there are any SMTP type attendees who have not declined meeting yet and then I decide my further processing.

    Please advise.

    Thanks,

    Suresh


    sureshh...

    Friday, September 2, 2016 5:24 AM

All replies

  • Hello Suresh,

    > But I observed that this logic does not work properly all the time and sometimes i observed that even though all declined responses landed in Inbox, probably tracking is not updated properly with all responses yet and so my logic still returns me few participants.

    Where and when is it run?

    Anyway, I'd suggest breaking a complex line of code and declaring each property or method call on a separate line of code. That allows to release underlying COM objects instantly.

    Do you release underlying COM objects in the code instantly?

    Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an Outlook object when you have finished using it. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. Read more about that in the Systematically Releasing Objects article.

    Note, when you work with recurring appointment items, you should release any prior references, obtain new references to the recurring appointment item before you access or modify the item, and release these references as soon as you are finished and have saved the changes. This practice applies to the recurring AppointmentItem object, and any Exception or RecurrencePattern object. 

    Even after you release your reference and attempt to obtain a new reference, if there is still an active reference, held by another add-in or Outlook, to one of the above objects, your new reference will still point to an out-of-date copy of the object. Therefore, it is important that you release your references as soon as you are finished with the recurring appointment.

    Did you try to check out the response status in the NewMailEx event handler?


    [custom.development]

    Friday, September 2, 2016 2:23 PM
  • Hi Eugene,

    Thanks for your response. Please find answers inline.

    > But I observed that this logic does not work properly all the time and sometimes i observed that even though all declined responses landed in Inbox, probably tracking is not updated properly with all responses yet and so my logic still returns me few participants.

    >>Where and when is it run?
    You got it right, it is run exactly in NewMailEx event handler as soon as it triggers when item lands in Inbox folder.

    >>Do you release underlying COM objects in the code instantly?

    Yes objects are release using same method wherever necessary

    >>Did you try to check out the response status in the NewMailEx event handler?

    As mentioned above, my above code line runs in NewMailEx event handler only.

    As I missing anything else here? So can you confirm if response lands in Inbox and we try to check its ResopnseStatus in NewMailEx event handler, during that time does Outook not update all incoming responses in original meeting tracking immediately as soon as it lands at Inbox folder?

    Please advise.

    Thanks.


    sureshh...

    Friday, September 2, 2016 2:54 PM
  • >>>But I observed that this logic does not work properly all the time and sometimes i observed that even though all declined responses landed in Inbox, probably tracking is not updated properly with all responses yet and so my logic still returns me few participants.

    According to your description, you could refer to The Outlook meeting tracking tab is not updated

    https://support.microsoft.com/en-sg/kb/2215547

    Thanks for your understanding.
    Monday, September 5, 2016 5:21 AM
  • Thanks David.

    I did look at this link before. It talks about many symptoms but does not really talk about possible solution. Also my problem here does not seem to match it. Actually in my case meeting tracking tabs gets updated most of the time, and I need to understand if in reality there could be a delay in updates to meeting tracking tab. In case there could be delays in such updates then is there any solution to force sync such updates as soon as response item lands in Inbox?

    I am thinking of introducing some delay in my checks i.e. when meeting response item lands in Inbox then I will delay my logic to check tracking updates for few milliseconds. But not sure if there would be any issues by doing this since Outlook is STA based process.

    Please advise.


    sureshh...

    Tuesday, September 6, 2016 9:32 PM
  • >>>Actually in my case meeting tracking tabs gets updated most of the time, and I need to understand if in reality there could be a delay in updates to meeting tracking tab. In case there could be delays in such updates then is there any solution to force sync such updates as soon as response item lands in Inbox?<<<

    According to your description, I think that Outlook Object Model is not able to support you to achieve this requirement.
     
    If you have any feedback for Outlook, please feel free to submit them to User Voice:

    https://outlook.uservoice.com/

    Thanks for your understanding.
    • Proposed as answer by David_JunFeng Tuesday, September 13, 2016 2:33 PM
    Thursday, September 8, 2016 6:58 AM