NameSpace::GetItemFromID fails on specific machine

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top