Share via


IMAPISession::OpenAddressBook returns E_NOINTERFACE when providing an IID

I am currently troubleshooting an issue and wrote some code in an effort to reproduce it.  However, when my program called into IMAPISession::OpenAddressBook and gave the IID IID_IAddrBook for the lpInterface parameter it would return E_NOINTERFACE.  This puzzled me because the method returns a pointer to the IAddrBook interface so it should "support" this interface.  After reviewing the source code I realized that if an interface is supplied, no matter what it is, the method will return E_NOINTERFACE.  Odd.  If you want the method to work you need to pass NULL.

 

Note: I was using 6.5.8131 of Exchange's MAPI.  I didn't test it with anything besides that.  Therefore, I don't know if Outlook's MAPI behaves differently.  I just wanted to get it out there.