【发布时间】:2016-12-07 21:32:47
【问题描述】:
我使用 Redemption (http://dimastr.com/redemption/home.htm) 来开发我的 Outlook 插件。当我第一次在 STA-thread(!) 中尝试 GetMessageFromId 时一切都很好,但在下一次我得到 MAPI_E_UNKNOWN_ENTRYID。
RDOSession rdoSession = null;.
rdoSession = new RDOSession();
if (rdoSession != null)
{
if (!rdoSession.LoggedOn)
rdoSession.Logon(Consts.ProfileName);
if (rdoSession.LoggedOn)
{
for (int c = 1; c <= rdoStoresCnt; c++)
{
/* other code */
RDOMail mail = null;
try
{
mail = rdoSession.GetMessageFromID(entryID);
/* other code */
}
catch (Exception ex)
{
if (mail != null) Marshal.ReleaseComObject(mail); mail = null;
}
finally
{
if (mail != null) Marshal.ReleaseComObject(mail); mail = null;
}
}
}
}
我做错了什么?
【问题讨论】:
标签: c# multithreading outlook mapi outlook-redemption