none
System.Runtime.InteropServices.COMException (0xB5904005): The operation failed. at Microsoft.Office.Interop.Outlook._Inspector.get_WordEditor() (Error in opening the WordEditor for an Appontment Item, Outlook v15.0.0.4693) RRS feed

  • Question

  • Hi,

    I have following line in my code:

    Word.Document doc = Inspector.WordEditor as Word.Document;

    This line is always throwing the following exception:

    System.Runtime.InteropServices.COMException (0xC8304005): The operation failed. at Microsoft.Office.Interop.Outlook._Inspector.get_WordEditor()
    

    This is only on an Outlook 2013 machine (v15.0.0.4693). The same code works well in other Outlook versions and even in Outlook 2013 v15.0.4420.1017.

    Is there anything I am doing wrong here? Or is this is specific to the Outlook version?

    Thanks in advance.


    Thanks Prasad

    Saturday, March 7, 2015 4:11 AM

All replies

  • When is this code invoked? Is it in the Inspectors.NewInspector event?

    Can you retrieve Word editor from OutlookSpy? Open a message, click Inspector button on the OutlookSpy ribbon, select WordEditor property, click Browse.


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

    Saturday, March 7, 2015 4:29 AM
  • Thanks for the reply Dmitry. This is invoked in Item_Open event for an Appointment Item.I checked using OutlookSpy and the WordEditor property is available. Also, I am executing this code only after checking whether Inspector.IsWordMail() is true or not.

    Thanks Prasad


    • Edited by Prasad U S Saturday, March 7, 2015 5:01 AM
    Saturday, March 7, 2015 4:57 AM
  • Is Outlook 32 or 64 bit?

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

    Saturday, March 7, 2015 5:11 AM
  • Its Outlook 32 bit.

    Thanks Prasad

    Saturday, March 7, 2015 5:51 AM
  • Can you run your code in the Inspector.Activate event? By that time WordEditor should be fully initialized.  

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

    Saturday, March 7, 2015 5:54 AM
  • Ok. Thank you. I will try it out and update.

    Thanks Prasad

    Saturday, March 7, 2015 5:57 AM
  • Hello Prasad,

    When the Open event is fired, the Inspector object should be initialized but not yet displayed. So, the code should work as expected. Where do you get the Inspector object?

    Are  you able to reproduce the issue with a newly created add-in?

    The fact is that the issue may depend on your code. Or there is a bug in Outlook.

    Saturday, March 7, 2015 9:55 AM
  • Hi Eugene,

    Thanks for your detailed reply. I have written a Wrapper class to get the Inspector for an Appointment Item. The code works well on Outlook 2007, 2010 and even 2013 (v15.0.4420.1017). Also, I don't have direct access to the machine where this problem has happened. Is this because of version of Outlook used?


    Thanks Prasad

    Saturday, March 7, 2015 3:52 PM
  • I don't think that the version makes any sense. Anyway, I always recommend installing the latest updates and service packs. 

    Try to create a new empty add-in without any additional code. Does it work as expected?

    Saturday, March 7, 2015 5:02 PM