2

I am using Redemption in some routines and one of those routines makes a call to:

RDOMail rdoMail = Globals.ThisAddIn.session.GetMessageFromID(mail.EntryID, folder.StoreID, Type.Missing);

And it throws this exception eventually, it does not always occurs:

Error in IMAPISession.OpenEntry: MAPI_E_NOT_FOUND StackTrace: at Interop.Redemption.IRDOSession.GetMessageFromID(String EntryIDMessage, Object EntryIDStore, Object Flags)

Why is it happening? anybody has any idea?

UPDATE

This is the context of the call:

Outlook.MailItem mail = folder.Items.Add(Outlook.OlItemType.olMailItem);
Outlook.Recipient r = Globals.ThisAddIn.Application.Session.CreateRecipient(getSingleAddress(mailDetails.from));
mail.To = mailDetails.to.Replace("&lt;", "<").Replace("&gt;", ">");
mail.Sender = r.AddressEntry;
mail.Subject = mailDetails.subject;

mail.Save();

RDOMail rdoMail = Globals.ThisAddIn.session.GetMessageFromID(mail.EntryID, folder.StoreID, Type.Missing);
Joe Almore
  • 4,036
  • 9
  • 52
  • 77

1 Answers1

0

This happens because MAPI cannot find the message with the specified entry id.

What is the context of this call? Where does mail variable come from? Do you call RDOSession.Logon or set the RDOSession.MAPIOBJECT property to Namespace.MAPIOBJEECT from Outlook?

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • Hi, thanks for your response. Just updated the question with code previous to the call. – Joe Almore Feb 06 '14 at 15:25
  • How do you initialize Globals.ThisAddIn.session? Do you call RDOSession.Logon or set the RDOSession.MAPIOBJECT property to Globals.ThisAddIn.Application.Session.MAPIOBJECT? – Dmitry Streblechenko Feb 07 '14 at 00:09
  • The initialization is like this `public RDOSession session = RedemptionLoader.new_RDOSession();` – Joe Almore Feb 07 '14 at 00:33
  • Yes, but do you call RDOSession.Logon or set the RDOSession.MAPIOBJECT property to Globals.ThisAddIn.Application.Session.MAPIOBJECT? – Dmitry Streblechenko Feb 07 '14 at 14:40
  • OK, this is what I do: `session.Logon(Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); session.MAPIOBJECT = Application.Session.MAPIOBJECT;` – Joe Almore Feb 08 '14 at 00:21
  • Do not do both: in an addin, just set the RDOSession.MAPIOBJECT property. – Dmitry Streblechenko Feb 09 '14 at 22:20
  • @Dmitry: the Application.Session.MAPIOBJECT shows 'This object, member, or enumeration is deprecated and is not intended to be used in your code'. What should be used instead? – Bernhard Jul 27 '21 at 05:08
  • Go ahead and use it - it is marked deprecated because VB and .Net languages cannot use it: it is an Extended MAPI interface (IMAPISession). – Dmitry Streblechenko Jul 27 '21 at 05:17