M
Matt Fletcher
I'm experiencing a problem on one of my (virtual) machines (but not on any
other machine) with GetItemFromID. I'm getting a null _MailItemPtr returned,
even though the entryID I supply is correct (I've checked it by tracing and
comparing with the value shown by OutlookSpy). Code snippet below. (Note
that the item being opened is in the inbox - I only added the StoreID in
case this was the cause of the problem.)
_NameSpacePtr spNamespace = spOutlookApplication->GetNamespace("MAPI");
if (spNamespace)
{
try
{
MAPIFolderPtr spInbox =
spNamespace->GetDefaultFolder(olFolderInbox);
_MailItemPtr spMailItem = spNamespace->GetItemFromID(m_bstrEntryID,
spInbox->StoreID);
if (spMailItem)
spMailItem->Display();
else
SPTRACE("m_bstrEntryID = %s, spInbox->StoreID = %s\n",
(LPCTSTR)m_bstrEntryID,
(LPCTSTR)spInbox->StoreID);
}
catch(...)
{
}
}
Thanks for any suggestions.
Matt Fletcher
other machine) with GetItemFromID. I'm getting a null _MailItemPtr returned,
even though the entryID I supply is correct (I've checked it by tracing and
comparing with the value shown by OutlookSpy). Code snippet below. (Note
that the item being opened is in the inbox - I only added the StoreID in
case this was the cause of the problem.)
_NameSpacePtr spNamespace = spOutlookApplication->GetNamespace("MAPI");
if (spNamespace)
{
try
{
MAPIFolderPtr spInbox =
spNamespace->GetDefaultFolder(olFolderInbox);
_MailItemPtr spMailItem = spNamespace->GetItemFromID(m_bstrEntryID,
spInbox->StoreID);
if (spMailItem)
spMailItem->Display();
else
SPTRACE("m_bstrEntryID = %s, spInbox->StoreID = %s\n",
(LPCTSTR)m_bstrEntryID,
(LPCTSTR)spInbox->StoreID);
}
catch(...)
{
}
}
Thanks for any suggestions.
Matt Fletcher