I'm developing a MAPI Address Book Provider. When I have addresses in the Address Book I can click on the icon "Add to contacts" and I get some calls on IMailUser::GetProps and then a Contact opens with the supported properties filled in. But when I open the detail dialog I get calls to all the properties from the dialog and when the dialog box is open I've got a button "Contacts" (beside "Add to:"). When I click there, I get a call to IMailUser::GetProps with PR_ENTRYID and then the Outlook error message "Some names could not be added to Contacts. The action could not be completed.".
On the detail dialog I've got almost all properties which I don't support yet (returning PT_ERROR / MAPI_E_NOT_FOUND in the property. Only the display name is supported yet. Is there a minimum required property set that this works?
In the same context I've got another design question: My backend database returns me a flag "business/private" and many properties. Should I display the detail dialog with a custom property like PR_GENERAL_PHONE_NUMBER (which contains the business or private phone number depending on the flag) or should I duplicate all fields (using PR_HOME_PHONE_NUMBER and PR_BUSINESS_PHONE_NUMBER) and fill in the received phone number into the correct field. (This applies to address, URL, etc. too). I would prefer the first way (custom properties) because otherwise one of both would always be empty. But if this makes trouble later adding them to a Contact etc. I'm willing to duplicate them. What is better?
> I'm developing a MAPI Address Book Provider. When I have addresses in the > Address Book I can click on the icon "Add to contacts" and I get some calls > on IMailUser::GetProps and then a Contact opens with the supported > properties filled in. But when I open the detail dialog I get calls to all > the properties from the dialog and when the dialog box is open I've got a > button "Contacts" (beside "Add to:"). When I click there, I get a call to > IMailUser::GetProps with PR_ENTRYID and then the Outlook error message "Some > names could not be added to Contacts. The action could not be completed.".
> On the detail dialog I've got almost all properties which I don't support > yet (returning PT_ERROR / MAPI_E_NOT_FOUND in the property. Only the display > name is supported yet. Is there a minimum required property set that this > works?
> In the same context I've got another design question: > My backend database returns me a flag "business/private" and many > properties. Should I display the detail dialog with a custom property like > PR_GENERAL_PHONE_NUMBER (which contains the business or private phone number > depending on the flag) or should I duplicate all fields (using > PR_HOME_PHONE_NUMBER and PR_BUSINESS_PHONE_NUMBER) and fill in the received > phone number into the correct field. (This applies to address, URL, etc. > too). I would prefer the first way (custom properties) because otherwise one > of both would always be empty. But if this makes trouble later adding them > to a Contact etc. I'm willing to duplicate them. What is better?
1. I'm supporting these two properties already and still receive "Some names could not be added to Contacts. The action could not be completed." What's the difference between the two methods to add an entry into a new contact? In both cases I support the same properties. Using the icon in the list it works, but with the button on the details it doesn't work. In the meantime I almost support all properties that exist - same error. Any ideas?
2. With fixed properties you mean the defined properties from the header files? Ok, I'll go that way. Thank you for your advice.
> "Eric" <bauersa...@kull.ch.nospam.me.com> wrote in message > news:cl65n1$cki$1@newshispeed.ch... > > I'm developing a MAPI Address Book Provider. When I have addresses in the > > Address Book I can click on the icon "Add to contacts" and I get some > calls > > on IMailUser::GetProps and then a Contact opens with the supported > > properties filled in. But when I open the detail dialog I get calls to all > > the properties from the dialog and when the dialog box is open I've got a > > button "Contacts" (beside "Add to:"). When I click there, I get a call to > > IMailUser::GetProps with PR_ENTRYID and then the Outlook error message > "Some > > names could not be added to Contacts. The action could not be > completed.".
> > On the detail dialog I've got almost all properties which I don't support > > yet (returning PT_ERROR / MAPI_E_NOT_FOUND in the property. Only the > display > > name is supported yet. Is there a minimum required property set that this > > works?
> > In the same context I've got another design question: > > My backend database returns me a flag "business/private" and many > > properties. Should I display the detail dialog with a custom property like > > PR_GENERAL_PHONE_NUMBER (which contains the business or private phone > number > > depending on the flag) or should I duplicate all fields (using > > PR_HOME_PHONE_NUMBER and PR_BUSINESS_PHONE_NUMBER) and fill in the > received > > phone number into the correct field. (This applies to address, URL, etc. > > too). I would prefer the first way (custom properties) because otherwise > one > > of both would always be empty. But if this makes trouble later adding them > > to a Contact etc. I'm willing to duplicate them. What is better?
> 1. I'm supporting these two properties already and still receive > "Some names could not be added to Contacts. > The action could not be completed." > What's the difference between the two methods to add an entry into a new > contact? In both cases I support the same properties. Using the icon in the > list it works, but with the button on the details it doesn't work. In the > meantime I almost support all properties that exist - same error. Any ideas?
> 2. With fixed properties you mean the defined properties from the header > files? Ok, I'll go that way. Thank you for your advice.
> Eric
> "Dmitry Streblechenko (MVP)" <dmi...@dimastr.com> wrote in message > news:ugScNKttEHA.1296@TK2MSFTNGP10.phx.gbl... > > 1. Off the top of my head, PR_EMAIL_ADDRESS and PR_ENTRYID must be > > supported. > > 2. I'd go with the fixed properties if I were you.
> > "Eric" <bauersa...@kull.ch.nospam.me.com> wrote in message > > news:cl65n1$cki$1@newshispeed.ch... > > > I'm developing a MAPI Address Book Provider. When I have addresses in > the > > > Address Book I can click on the icon "Add to contacts" and I get some > > calls > > > on IMailUser::GetProps and then a Contact opens with the supported > > > properties filled in. But when I open the detail dialog I get calls to > all > > > the properties from the dialog and when the dialog box is open I've got > a > > > button "Contacts" (beside "Add to:"). When I click there, I get a call > to > > > IMailUser::GetProps with PR_ENTRYID and then the Outlook error message > > "Some > > > names could not be added to Contacts. The action could not be > > completed.".
> > > On the detail dialog I've got almost all properties which I don't > support > > > yet (returning PT_ERROR / MAPI_E_NOT_FOUND in the property. Only the > > display > > > name is supported yet. Is there a minimum required property set that > this > > > works?
> > > In the same context I've got another design question: > > > My backend database returns me a flag "business/private" and many > > > properties. Should I display the detail dialog with a custom property > like > > > PR_GENERAL_PHONE_NUMBER (which contains the business or private phone > > number > > > depending on the flag) or should I duplicate all fields (using > > > PR_HOME_PHONE_NUMBER and PR_BUSINESS_PHONE_NUMBER) and fill in the > > received > > > phone number into the correct field. (This applies to address, URL, etc. > > > too). I would prefer the first way (custom properties) because otherwise > > one > > > of both would always be empty. But if this makes trouble later adding > them > > > to a Contact etc. I'm willing to duplicate them. What is better?
1. Well, when opening the dialog, Outlook requests all the properties on the dialog (about one hundred props like Email, First Name, Last Name, Phone, etc. and some own properties). When clicking on the "Add to Contacts" button, Outlook only requests PR_ENTRYID, nothing more (perhaps because Outlook has sufficient infos already). And then the error message appears.
My next step: I'm gonna try to make a new dialog (instead of the big one) with only one private property and try what Outlook then requests afterwards. I'll post the results here. But if you have any other idea, just let me know...
Test results with simple dialog: Didn't change a thing. With the Add button the following properties are being asked: (before opening the dialog): PR_INITIAL_DETAILS_PANE (return unsupported; PT_ERROR/E_NOT_FOUND), the one private property on the simple dialog (unsupp.), then click an Add button, PR_ENTRYID -> error message.
With the toolbar-icon method I get asked for PR_OBJECT_TYPE (return MAPI_MAILUSER), PR_DISPLAY_NAME, PropertyTag=1 (?, unsupported), PR_COMMENT (unsupported), PR_EMAIL_ADDRESS, PR_ADDRTYPE (return "SMTP"), PR_ORIGINAL_DISPLAY_NAME (unsupp.), PR_ENTRYID, 0x8005001E, 0x8CCA1102, PR_ACCOUNT (all unsupp.), etc. Actually no real difference.
In the meantime I found out what the problem was: The property PR_ENTRYID was a pointer to a local variable on the stack. In one case it was already destroyed, in the other case it worked... Now I made a CEntryIdProperty class with all memory handling etc. (like a CStringProperty class I've got already) and everything works. Thanks for your help anyway.
Whatever you return from GetProps does not belong to you anymore, you cannot use local (stack) variables or any memory allocated using your private (class constructors etc) memory management functions. You must allocate SPropValueArray using MAPIAllocateBuffer, then allocate all child pointers (such as SPropValue.Value.bin.lpb for the PR_ENTRYID property) using MAPIAllocateMore. This is the only way to do it.
> Test results with simple dialog: Didn't change a thing. > With the Add button the following properties are being asked: (before > opening the dialog): PR_INITIAL_DETAILS_PANE (return unsupported; > PT_ERROR/E_NOT_FOUND), the one private property on the simple dialog > (unsupp.), then click an Add button, PR_ENTRYID -> error message.
> With the toolbar-icon method I get asked for PR_OBJECT_TYPE (return > MAPI_MAILUSER), PR_DISPLAY_NAME, PropertyTag=1 (?, unsupported), PR_COMMENT > (unsupported), PR_EMAIL_ADDRESS, PR_ADDRTYPE (return "SMTP"), > PR_ORIGINAL_DISPLAY_NAME (unsupp.), PR_ENTRYID, 0x8005001E, 0x8CCA1102, > PR_ACCOUNT (all unsupp.), etc. > Actually no real difference.
> In the meantime I found out what the problem was: The property PR_ENTRYID > was a pointer to a local variable on the stack. In one case it was already > destroyed, in the other case it worked... > Now I made a CEntryIdProperty class with all memory handling etc. (like a > CStringProperty class I've got already) and everything works. Thanks for > your help anyway.