none
Exception when retrieving Email Item from Outlook with Microsoft.Office.Interop.Outlook RRS feed

  • Question

  • Hi everyone!

    Hope things are going well with you :)

    I just have a quick question regarding of method "object GetItemFromID(string EntryIDItem, object EntryIDStore);" in Microsoft.Office.Interop.Outlook library.

    I am using this method to retrieve email item in my C# application and getting an exception saying "The item has been moved or deleted."

    However, the corresponding mailbox and the email item exists in Outlook and having hard time to find the root cause of this issue.

    In order to fix this issue, I removed the mailbox and re-added it and now it is not throwing the error anymore.

    Can you guys advise or give any clues to track down the root cause of this issue?

    The mailbox name was renamed before and only thing I can guess is that the previous mailbox name was cached in Outlook and it failed to retrieve emails. I'm guessing that's why re-adding the mailbox to outlook resolved the issue.  

    Any answer be much appreciated!!

     

    Thursday, November 7, 2019 7:05 PM

All replies

  • Hello,

    The EntryID value can be changed when items are moved to another folder/store. It actually depends on the store provider implementation. So, I'd suggest checking the EntryID value on the item you have got in the profile and compare it to the one passed to the NameSpace.GetItemFromID method. Are they the same?


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

    Thursday, November 7, 2019 7:39 PM
  • Hi Eugene thanks for the answer.

    Unfortunately, I am not able to confirm that now, but maybe tomorrow!

    Btw, what do you mean by  store provider implementation? Could you explain more details about this?

    Thursday, November 7, 2019 8:21 PM
  • What kind of item is it? Keep in mind that appointments are recreated by Outlook when it processes a meeting notification. Entry id also changes if an item is moved to a different folder in an Exchange store (it stays the same in a PST store).

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

    Thursday, November 7, 2019 8:51 PM
  • The entry id changes under in an Exchange store (online, cached, Public Folders) if an item is moved. It stays the same under the PST provider.

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

    Thursday, November 7, 2019 8:52 PM
  • Hi Dmitry, it is MailItem object and it exists at shared Mailbox. (Exchange Server). Does that mean if shared mailbox name gets changed, Entry ID can be changed as well?
    Thursday, November 7, 2019 9:53 PM
  • Are you sure you are specifying the right store entry id? Where does it come from?

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

    Thursday, November 7, 2019 11:05 PM
  • Yes, Dmitry. I think entry IDs are same and they came from my DB. The entry IDs were retrieved from Exchange server to my DB. If entry IDs were changed, then removing the shared mailbox and re-adding it, it shouldn

    t still work.. so that's the mystery..now

    Friday, November 8, 2019 12:46 PM
  • "I think" is not quite the same as "I know" :-)

    Read the entry id of the message in Outlook (you can do that from OutlookSpy - select the message, click Item, select the EntryID property), copy it to the clipboard and paste in Notepad. Also paste the entry id from the DB.

    Are the two the same? They can be different by a single character. I usually use Find on one of the values - if both values are found, they are obviously the same.


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

    Friday, November 8, 2019 5:36 PM