none
the operation failed error whilst reading recipients property in outlook addin RRS feed

  • Question

  • Hi,

    we have developed outlook addin and we deployed it on outlook 2010 sp2 and is having latest patch.

    Now on few machines where addin is installed , whilst trying to get rceipients property of outlook appointment item. i get this error

    Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._AppointmentItem'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063033-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))

    dim AppItemas outlook.appintmentitem

    Dim Recipients As Outlook.Recipients = Nothing

    Recipients = AppItem.Recipients (assume apppitem has been initalised) --effected machines are  getting error here

    I also get similar error when try to access the a MAPIfolder which is actually a celndaritem  saved in .net collection object

    Dim CalendarFolderItems As Outlook.Items = Nothing

    For index = 1 To CalendarCollection.Count
                        Log("setlocation for loop " + index.ToString())
                        If (CalendarCollection(index).EmailAddress = email) Then
                            Log("setlocation email " + email)
                            CalendarFolderItems = CalendarCollection(index).FolderItems -- effected machines are  getting error here

                       End if

    Next

    Now, we already tried repairing outlook on effcted machine but it did not resolve issue

    Not sure but can it be due to some conflict in registry?

    Thanks


    Thursday, May 18, 2017 2:06 PM

All replies

  • Are you doing this in a separate thread?

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

    Thursday, May 18, 2017 3:21 PM
  • yes, one with getting recipient information is using a timer function

    other operation is  done after  an asynchronus operation is complete.

    but again, as i said this is happening on some of machine but not all


    Thursday, May 18, 2017 7:00 PM
  • Can't do that - OOM can only be used on the main Outlook thread if you are running inside an addin. If you are running outside of the outlook.exe address space, all calls will be marshalled to the main Outlook thread anyway.

    If you are using the Timer class, use the one from the Forms namespace - it fires on the main thread.


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

    Thursday, May 18, 2017 7:52 PM
  • ok i can try that. but question is why its happening on some machine but not on all. i never come across such issue before and it always worked for me and is working till date. this applies to both of above mentioned scenario.

    Also, in second case where effected machine get error, my main idea was that any network call should not block main thread, so that outlook keeps on doing what it is . now after network call complete , then on the basis of data that addin got it updates the appointment properties, mainly location actually.

    it does not get the appointment directly, it first looks for correct calendar folder  and then search an appointment in that calendar based on some filter








    • Edited by Nitrup Thursday, May 18, 2017 9:22 PM
    Thursday, May 18, 2017 8:51 PM
  • That's the problem with threading in OOM - it fails at the worst possible moment. Outlook 2016 raises an outright exception as soon as it detects a call on a thread other than the main one.

    If you want to use multiple threads, Extended MAPI (C++ or Delphi) or Redemption n(MAPI wrapper, can be used from any language) are your only options. In case of Redemption, see this.


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

    Thursday, May 18, 2017 10:45 PM
  • Hi Dmitry,

    I will keep in mind your suggestion, but the actual problem was resolved by resolving some registery conflicts on effected machine and the above mentioned error no longer appears

    Thanks

    Thursday, June 1, 2017 8:29 PM