Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Outlook C++ com addin

Outlook C++ com addin

Scheduled Pinned Locked Moved COM
helpc++com
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bangerman
    wrote on last edited by
    #1

    Hi, I'm having a problem when iterating through the contacts in Outlook. I can create contacts ok and access all the properties of them, but when I try to iterate through them I get an exception. Can anyone see what I'm doing wrong :confused:

    \_NameSpacePtr pNamespace;
    \_ItemsPtr pItems;
    \_FoldersPtr pFolders;
    MAPIFolderPtr pFolder;
    \_ContactItemPtr pContact;
    CComVariant vIndex;
    
    m\_spApp->GetNamespace(\_bstr\_t("MAPI"),&pNamespace);
    // select the default outlook contacts folder
    pNamespace->GetDefaultFolder(olFolderContacts,&pFolder);
    pFolder->get\_Items(&pItems);
    Outlook::OlObjectClass Class;
    CComBSTR EntryId;
    pItems->get\_Class(&Class);
    // iterate the list
    hr=pItems->GetFirst((IDispatch\*\*)&pContact);
    while ((hr==S\_OK) && (pContact!=NULL))
    {
    	pContact->get\_Class(&Class);
    	if (Class==olContact)
    	{
    		pContact->get\_EntryID(&EntryId); // exception thrown on this line
    		hr=pItems->GetNext((IDispatch\*\*)&pContact);
    	}
    }
    

    Any help you can offer would be greatly appreciated.;P

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups