R
Richard Bang
Could anyone tell me why this code fails as I cannot figure it out and this
is my first com plug in
_NameSpacePtr pNamespace;
_ItemsPtr pItems;
_FoldersPtr pFolders;
MAPIFolderPtr pFolder;
_ContactItemPtr pContact;
m_spApp->GetNamespace(_bstr_t("MAPI"),&pNamespace);
// select the default outlook contacts folder
pNamespace->GetDefaultFolder(olFolderContacts,&pFolder);
pFolder->get_Items(&pItems);
hr=pItems->GetFirst((IDispatch**)&pContact);
while (hr==S_OK)
{
CComBSTR Value;
pContact->get_EntryID(&Value); // exception thrown on this line
pContact->Release();
hr=pItems->GetNext((IDispatch**)&pContact);
}
The failure when trying to get EntryId is a real pain.
Any help would be greatly appreciated.
is my first com plug in
_NameSpacePtr pNamespace;
_ItemsPtr pItems;
_FoldersPtr pFolders;
MAPIFolderPtr pFolder;
_ContactItemPtr pContact;
m_spApp->GetNamespace(_bstr_t("MAPI"),&pNamespace);
// select the default outlook contacts folder
pNamespace->GetDefaultFolder(olFolderContacts,&pFolder);
pFolder->get_Items(&pItems);
hr=pItems->GetFirst((IDispatch**)&pContact);
while (hr==S_OK)
{
CComBSTR Value;
pContact->get_EntryID(&Value); // exception thrown on this line
pContact->Release();
hr=pItems->GetNext((IDispatch**)&pContact);
}
The failure when trying to get EntryId is a real pain.
Any help would be greatly appreciated.