On 03/23/11 10:34, Alois Schloegl wrote:
On 03/22/11 21:31, Brad Hards wrote:
On Wed, 23 Mar 2011 03:44:30 am Alois Schloegl wrote:
bin/openchangeclient --pf --fetch-items=Contact --folder "Our Contacts"
I'm not sure exactly which email address information you're trying to get, but
perhaps you can run the command with --dump-data -d9 and determine which
property you need from that?
Brad
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel
Dear Brad,
thanks for this hint. Now, I can that the e-mail addresses are there.
Below is an example where the e-mail addresses are stored.
lpProps: struct mapi_SPropValue
ulPropTag :
UNKNOWN_ENUM_VALUE (0x802C001E)
value : union
mapi_SPropValue_CTR(case 30)
lpszA :
'[email protected]'
lpProps: struct mapi_SPropValue
ulPropTag :
UNKNOWN_ENUM_VALUE (0x802F001E)
value : union
mapi_SPropValue_CTR(case 30)
lpszA :
'gggggggg wwwww ([email protected])'
lpProps: struct mapi_SPropValue
ulPropTag :
UNKNOWN_ENUM_VALUE (0x803B001E)
value : union
mapi_SPropValue_CTR(case 30)
lpszA :
'[email protected]'
lpProps: struct mapi_SPropValue
ulPropTag :
UNKNOWN_ENUM_VALUE (0x81DC0102)
value : union
mapi_SPropValue_CTR(case 258)
bin :
SBinary_short cb=174
[0000] 00 00 00 00 81 2B 1F A4 BE A3 10 19 9D 6E 00 DD .....+.. .....n..
[0010] 01 0F 54 02 00 00 01 80 47 00 65 00 72 00 68 00 ..T..... g.g.g.g.
[0020] 61 00 72 00 64 00 20 00 57 00 69 00 63 00 68 00 g.g.g. . w.w.w.w.
[0030] 65 00 20 00 28 00 67 00 65 00 72 00 68 00 61 00 w. .(.g. g.g.g.g.
[0040] 72 00 64 00 2E 00 77 00 69 00 63 00 68 00 65 00 g.g...w. w.w.w.w.
[0050] 40 00 75 00 6E 00 69 00 76 00 69 00 65 00 2E 00 @.u.n.i. v.i.e...
[0060] 61 00 63 00 2E 00 61 00 74 00 29 00 00 00 53 00 a.c...a. t.)...S.
[0070] 4D 00 54 00 50 00 00 00 67 00 65 00 72 00 68 00 M.T.P... g.g.g.g.
[0080] 61 00 72 00 64 00 2E 00 77 00 69 00 63 00 68 00 g.g.g... w.w.w.w.
[0090] 65 00 40 00 75 00 6E 00 69 00 76 00 69 00 65 00 [email protected]. i.v.i.e.
[00A0] 2E 00 61 00 63 00 2E 00 61 00 74 00 00 00 ..a.c... a.t...
So, these enum values are relevant:
0x802C001E
0x802F001E
0x803B001E
0x81DC0102
Two of these are defined in ./libmapi/conf/mapi-properties
0x802f001e PR_EMS_AB_EXTENSION_ATTRIBUTE_3
0x803b001e PR_EMS_AB_HELP_FILE_NAME
but it seems they are not recognized in libmapi/mapidump.c.
Adding the following code in the function mapidump_contact in file
libmapi/mapidump.c does not return the e-mail addresses.
email = (const char *)find_mapi_SPropValue_data(properties,
PidLidEmail1OriginalDisplayName);
+ if (!email)
+ email = (const char
*)find_mapi_SPropValue_data(properties, 0x803B001E);
+ if (!email)
+ email = (const char
*)find_mapi_SPropValue_data(properties, 0x802C001E);
+ if (!email)
+ email = (const char
*)find_mapi_SPropValue_data(properties, 0x802F001E);
+ if (!email)
+ email = (const char
*)find_mapi_SPropValue_data(properties, 0x803B001E);
Do you have any idea how to proceed in order to extract the e-mail
addresses ?
Best regards,
Alois
After some debugging I found a way to extract the e-mail addresses from
contact folders. Attached is the diff against the current SVN
repository. The patch extracts all (up to) 3 e-mail addresses from the
contacts folder.
The corresponding property values 0x80[89a][034]001e are defined
[MS_OXPROPS]. These values are not yet defined in
./libmapi/property_altnames.h
Best regards,
Alois
Index: libmapi/mapidump.c
===================================================================
--- libmapi/mapidump.c (revision 2748)
+++ libmapi/mapidump.c (working copy)
@@ -2,6 +2,7 @@
OpenChange MAPI implementation.
Copyright (C) Julien Kerihuel 2007-2011.
+ Copyright (C) Alois Schloegl, IST Austria, 2011.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -548,7 +549,9 @@
const char *given_name = NULL;
const char *surname = NULL;
const char *company = NULL;
- const char *email = NULL;
+ const char *email1 = NULL;
+ const char *email2 = NULL;
+ const char *email3 = NULL;
const char *title = NULL;
const char *office_phone = NULL;
const char *home_phone = NULL;
@@ -570,7 +573,39 @@
given_name = (const char *)find_mapi_SPropValue_data(properties, PR_GIVEN_NAME);
surname = (const char *)find_mapi_SPropValue_data(properties, PR_SURNAME);
department = (const char *)find_mapi_SPropValue_data(properties, PR_DEPARTMENT_NAME);
- email = (const char *)find_mapi_SPropValue_data(properties, PidLidEmail1OriginalDisplayName);
+
+// these definitions should go somewhere else; perhaps ./libmapi/property_altnames.h but is built by script/makepropslist.py
+#define PR_EMAIL1_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x8080) /* 0x8080001E */
+#define PR_EMAIL1_EMAIL_ADDDESS PROP_TAG(PT_STRING8 , 0x8083) /* 0x8083001E */
+#define PR_EMAIL1_ORIGINAL_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x8084) /* 0x8084001E */
+#define PR_EMAIL2_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x8090) /* 0x9080001E */
+#define PR_EMAIL2_EMAIL_ADDRESS PROP_TAG(PT_STRING8 , 0x8093) /* 0x9083001E */
+#define PR_EMAIL2_ORIGINAL_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x8094) /* 0x9084001E */
+#define PR_EMAIL3_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x80A0) /* 0xA080001E */
+#define PR_EMAIL3_EMAIL_ADDRESS PROP_TAG(PT_STRING8 , 0x80A3) /* 0xA083001E */
+#define PR_EMAIL3_ORIGINAL_DISPLAY_NAME PROP_TAG(PT_STRING8 , 0x80A4) /* 0xA084001E */
+
+ if (!email1) email1 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL1_DISPLAY_NAME);
+ if (email1 && !strchr(email1,'@')) email1 = NULL;
+ if (!email1) email1 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL1_EMAIL_ADDDESS);
+ if (email1 &&!strchr(email1,'@')) email1 = NULL;
+ if (!email1) email1 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL1_ORIGINAL_DISPLAY_NAME);
+ if (email1 &&!strchr(email1,'@')) email1 = NULL;
+
+ if (!email2) email2 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL2_DISPLAY_NAME);
+ if (email2 && !strchr(email2,'@')) email2 = NULL;
+ if (!email2) email2 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL2_EMAIL_ADDRESS);
+ if (email2 && !strchr(email2,'@')) email2 = NULL;
+ if (!email2) email2 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL2_ORIGINAL_DISPLAY_NAME);
+ if (email2 && !strchr(email2,'@')) email2 = NULL;
+
+ if (!email3) email3 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL3_DISPLAY_NAME);
+ if (email3 && !strchr(email3,'@')) email3 = NULL;
+ if (!email3) email3 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL3_EMAIL_ADDRESS);
+ if (email3 && !strchr(email3,'@')) email3 = NULL;
+ if (!email3) email3 = (const char *)find_mapi_SPropValue_data(properties, PR_EMAIL3_ORIGINAL_DISPLAY_NAME);
+ if (email3 && !strchr(email3,'@')) email3 = NULL;
+
office_phone = (const char *)find_mapi_SPropValue_data(properties, PR_OFFICE_TELEPHONE_NUMBER);
home_phone = (const char *)find_mapi_SPropValue_data(properties, PR_HOME_TELEPHONE_NUMBER);
mobile_phone = (const char *)find_mapi_SPropValue_data(properties, PR_MOBILE_TELEPHONE_NUMBER);
@@ -602,8 +637,39 @@
fflush(0);
if (company) printf("Company: %s\n", company);
fflush(0);
- if (email) printf("E-mail: %s\n", email);
+
+ // convert to unix style e-mail addresses "Fffff Nnnnnn ([email protected])" to "Fffff Nnnnn <[email protected]>"
+ int i;
+ char *tmpemail = NULL;
+ if (email1) {
+ tmpemail = realloc(tmpemail,strlen(email1)+1);
+ strcpy(tmpemail,email1);
+ for (i=0; i<strlen(tmpemail); i++)
+ if (tmpemail[i]=='(') tmpemail[i]='<';
+ else if (tmpemail[i]==')') tmpemail[i]='>';
+ printf("E-mail1: %s\n", tmpemail);
+ }
fflush(0);
+ if (email2) {
+ tmpemail = realloc(tmpemail,strlen(email2)+1);
+ strcpy(tmpemail,email2);
+ for (i=0; i<strlen(tmpemail); i++)
+ if (tmpemail[i]=='(') tmpemail[i]='<';
+ else if (tmpemail[i]==')') tmpemail[i]='>';
+ printf("E-mail2: %s\n", tmpemail);
+ }
+ fflush(0);
+ if (email3) {
+ tmpemail = realloc(tmpemail,strlen(email3)+1);
+ strcpy(tmpemail,email3);
+ for (i=0; i<strlen(tmpemail); i++)
+ if (tmpemail[i]=='(') tmpemail[i]='<';
+ else if (tmpemail[i]==')') tmpemail[i]='>';
+ printf("E-mail3: %s\n", tmpemail);
+ }
+ if (tmpemail) free(tmpemail);
+ fflush(0);
+
if (office_phone) printf("Office phone number: %s\n", office_phone);
fflush(0);
if (home_phone) printf("Work phone number: %s\n", home_phone);
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel