none
When clicking New Email from Outlook, Inspector.CurrentItem gives the body of a previously sent email. RRS feed

  • Question

  • Hi,

    I have an Add-in for Outlook.

    When clicking New Email from Outlook, the body of the previously sent Email comes out of nowhere onto the New Email window.

    When I debugged the code I found out that Inspector.CurrentItem.Body gives the body of the previously sent email. It should be null instead. This happens only on the first click of New Email button. Subsequent clicks on New Email do not give me the previous email's body.

    This happens only with Emails and ONLY with 2010 Outlook. This issue doesn't happen on Outlook 2013 and 2016.

    This looks like a bug with Outlook APIs.

    Please let me know the problem here and any workarounds until Microsoft fixes this issue.

    Thanks in advance,

    Saranya

    Wednesday, June 20, 2018 4:44 PM

Answers

  • Please show the relevant snippet of your code.

    Microsoft will not be fixing that or any other issues in Outlook 2010 - it is out of support.


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

    Wednesday, June 20, 2018 4:57 PM
  • Thanks for the update. Can you please provide me a link that states Microsoft has stopped supporting Outlook 2010?

    The end of support for Outlook 2010 was 10/13/2015.  From that date through the end of the extended support period on 10/13/2020 Microsoft will only provide security updates.

    See https://support.microsoft.com/en-us/lifecycle/search?alpha=Microsoft%20Outlook%202010

    Wednesday, June 20, 2018 5:23 PM
  • Hello Saranya,

    You can check the EntryID property of the MailItem, new items don't have it set yet (not saved). Also to differentiate replies and forward items (they may not have entry IDs set as well) you can check the Recipients and other related properties. A newly created item will not have them set (except created based on templates). 

    The Outlook object model provides three main ways for working with item bodies:

    1. Body.
    2. HTMLBody.
    3. The Word editor. The WordEditor property of the Inspector class returns an instance of the Word Document which represents the message body. So, you can use the Word object model do whatever you need with the message body.

    It is up to you which way is to choose to remove the message body content.



    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, June 20, 2018 8:03 PM

All replies

  • Please show the relevant snippet of your code.

    Microsoft will not be fixing that or any other issues in Outlook 2010 - it is out of support.


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

    Wednesday, June 20, 2018 4:57 PM
  • Hi Dmitry,

    Thanks for the update. Can you please provide me a link that states Microsoft has stopped supporting Outlook 2010?

    This will be of great help.

    Also can you provide me a workaround that I can use in my code to remove the body that the Inspector.CurrentItem has?

    For example, I can check if it is a new email, then I can remove the body of the new email through my code.

    Can you please provide me a code snippet to do this?

    Thanks,

    Saranya

    Wednesday, June 20, 2018 5:01 PM
  • Thanks for the update. Can you please provide me a link that states Microsoft has stopped supporting Outlook 2010?

    The end of support for Outlook 2010 was 10/13/2015.  From that date through the end of the extended support period on 10/13/2020 Microsoft will only provide security updates.

    See https://support.microsoft.com/en-us/lifecycle/search?alpha=Microsoft%20Outlook%202010

    Wednesday, June 20, 2018 5:23 PM
  • Hello Saranya,

    You can check the EntryID property of the MailItem, new items don't have it set yet (not saved). Also to differentiate replies and forward items (they may not have entry IDs set as well) you can check the Recipients and other related properties. A newly created item will not have them set (except created based on templates). 

    The Outlook object model provides three main ways for working with item bodies:

    1. Body.
    2. HTMLBody.
    3. The Word editor. The WordEditor property of the Inspector class returns an instance of the Word Document which represents the message body. So, you can use the Word object model do whatever you need with the message body.

    It is up to you which way is to choose to remove the message body content.



    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, June 20, 2018 8:03 PM
  • Thank you
    Thursday, June 21, 2018 6:29 AM
  • Thank you
    Thursday, June 21, 2018 6:29 AM