Getting PR_EMS_AB_HOME_MDB in an Addin written with c#

K

Kelly Johnson

According to MSDN, PR_EMS_AB_HOME_MDB , equates to: &H8006001E
(0x8006001E in c#), which also equates to: 2147876894.

In my code, everytime I try to reference this property I get "
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]"

Is it possible that this property does not exist as part of CDO 1.21?
If it does, is there another way to access it?


Here is the code that errors when trying to access that property:

/* references microsoft.cdo 1.21 */
const long PR_EMS_AB_HOME_MDB = (long)0x8006001E;
MAPI.SessionClass oSession = new MAPI.SessionClass();
oSession.Logon("", "", false, false, System.Reflection.Missing.Value,
false, System.Reflection.Missing.Value);

MAPI.AddressEntry oCurrentUser;
MAPI.Fields oFields;
MAPI.Field oField;

oCurrentUser = (MAPI.AddressEntry)oSession.CurrentUser;

oFields = (MAPI.Fields)oCurrentUser.Fields;

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
//oField = (MAPI.Field)oFields.get_Item(PR_EMS_AB_HOME_MDB,
Missing.Value);

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
//oField = (MAPI.Field)oFields.get_Item(0x8006001E, Missing.Value);

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
oField = (MAPI.Field)oFields.get_Item(2147876894, Missing.Value);


Anyone have any suggestions?

Thank you very much,
Kelly Johnson
(e-mail address removed)
 
D

Dmitry Streblechenko \(MVP\)

Most likely this is a CDO bug - when it accesses any object derived from
IMAPIProp (such as IMailUser in this case) it calls IMAPIProp::GetPropList
to cache the list of available properties. When you access any properties
using Fields(), CDO looks at the cache first and reports an error since
PR_EMS_AB_HOME_MDB is not advertised by IMAPIProp::GetPropList.
The only workaround is to switch to Extended MAPI
(IMAPISession::QueryIdentity) or Redemption (Redemption.SafeCurrentUser
object)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
K

Kelly Johnson

Ok. Thank you very much Dmitry.

Dmitry Streblechenko \(MVP\) said:
Most likely this is a CDO bug - when it accesses any object derived from
IMAPIProp (such as IMailUser in this case) it calls IMAPIProp::GetPropList
to cache the list of available properties. When you access any properties
using Fields(), CDO looks at the cache first and reports an error since
PR_EMS_AB_HOME_MDB is not advertised by IMAPIProp::GetPropList.
The only workaround is to switch to Extended MAPI
(IMAPISession::QueryIdentity) or Redemption (Redemption.SafeCurrentUser
object)

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


Kelly Johnson said:
According to MSDN, PR_EMS_AB_HOME_MDB , equates to: &H8006001E
(0x8006001E in c#), which also equates to: 2147876894.

In my code, everytime I try to reference this property I get "
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(8004010F)]]"

Is it possible that this property does not exist as part of CDO 1.21?
If it does, is there another way to access it?


Here is the code that errors when trying to access that property:

/* references microsoft.cdo 1.21 */
const long PR_EMS_AB_HOME_MDB = (long)0x8006001E;
MAPI.SessionClass oSession = new MAPI.SessionClass();
oSession.Logon("", "", false, false, System.Reflection.Missing.Value,
false, System.Reflection.Missing.Value);

MAPI.AddressEntry oCurrentUser;
MAPI.Fields oFields;
MAPI.Field oField;

oCurrentUser = (MAPI.AddressEntry)oSession.CurrentUser;

oFields = (MAPI.Fields)oCurrentUser.Fields;

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
//oField = (MAPI.Field)oFields.get_Item(PR_EMS_AB_HOME_MDB,
Missing.Value);

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
//oField = (MAPI.Field)oFields.get_Item(0x8006001E, Missing.Value);

//causes error: " [Collaboration Data Objects -
[MAPI_E_NOT_FOUND(8004010F)]]"
oField = (MAPI.Field)oFields.get_Item(2147876894, Missing.Value);


Anyone have any suggestions?

Thank you very much,
Kelly Johnson
(e-mail address removed)
 

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