Hi List,

I've been working today on a long-time issue we had in OpenChange. Some
users were reporting problems sending e-mail to people within their
organization. Furthermore we were unable to send emails to Exchange 2010
servers - SubmitMessage was returning ecInvalidRecipients error.

The following patch fixes this.

It basically improves the logic within the RecipientFlags bitmask
calculation function and make use of different MAPI properties for
ModifyRecipients. 

To have a look at the SRowSet contents we pass to ModifyRecipients,
please have a look either at:
- utils/openchangeclient.c:openchangeclient_sendmail
- utils/mapitest/mapitest_common.c.

I would appreciate some feedback before pushing it into trunk for 0.9
release. It is quite an invasive change in term of features scope, so
I'd rather be sure it works properly before applying it.

For the record: with Exchange 2010, I was also able to send emails to
distribution lists.

Exchange 2003 && mapitest
=================================================
 [STAT] FAILURE REPORT
######################
------------------------------------------------------------------------
[STAT] TEST SUMMARY
####################
        Number of passing tests: 109
        Number of failing tests: 0
------------------------------------------------------------------------



Exchange2010 && mapitest
=================================================
[STAT] FAILURE REPORT
######################
        * OXCSTOR                            : OXCSTOR-GETSTORESTATE
        * OXCTABLE                           : OXCTABLE-QUERYCOLUMNS
        * OXCTABLE                           : OXCTABLE-GETSTATUS
        * OXCTABLE                           : OXCTABLE-SEEKROW-APPROX
        * OXCTABLE                           : OXCTABLE-CREATE-BOOKMARK
        * OXCTABLE                           : OXCTABLE-SEEKROW-BOOKMARK
        * OXOMSG                             : OXOMSG-TRANSPORT-NEW-MAIL
        * OXCMSG                             : OXCMSG-SET-READ-FLAGS
        * OXCMSG                             : OXCMSG-GET-MESSAGE-STATUS
        * OXCMSG                             : OXCMSG-GET-VALID-ATTACHMENTS
        * OXCPRPT                            : OXCPRPT-COPY-PROPS
        * OXCPRPT                            : OXCPRPT-STREAM
        * OXCPRPT                            : OXCPRPT-COPYTO
        * OXCPRPT                            : OXCPRPT-WRITE-COMMIT-STREAM
        * OXCPRPT                            : OXCPRPT-COPYTO-STREAM
        * OXCPRPT                            : OXCPRPT-NAME-ID
        * NSPI                               : NSPI-QUERYROWS
        * NSPI                               : NSPI-GETMATCHES
        * NSPI                               : NSPI-MODPROPS
------------------------------------------------------------------------
[STAT] TEST SUMMARY
####################
        Number of passing tests: 90
        Number of failing tests: 19


Cheers,
Julien.

-- 
Julien Kerihuel
[email protected]
OpenChange Project Manager

GPG Fingerprint: 0B55 783D A781 6329 108A  B609 7EF6 FE11 A35F 1F79

Index: libmapi/property.c
===================================================================
--- libmapi/property.c	(revision 1615)
+++ libmapi/property.c	(working copy)
@@ -624,12 +624,11 @@
  */
 _PUBLIC_ uint32_t SRowSet_propcpy(TALLOC_CTX *mem_ctx, struct SRowSet *SRowSet, struct SPropValue SPropValue)
 {
-	uint32_t	rows;
-	uint32_t	cValues;
-	struct SPropValue lpProp;
+	uint32_t		rows;
+	uint32_t		cValues;
+	struct SPropValue	lpProp;
 
 	/* Sanity checks */
-
 	if (!SRowSet) return 1;
 
 	for (rows = 0; rows < SRowSet->cRows; rows++) {
Index: libmapi/IMessage.c
===================================================================
--- libmapi/IMessage.c	(revision 1615)
+++ libmapi/IMessage.c	(working copy)
@@ -525,72 +525,144 @@
 }
 
 
-/*
- * EXPERIMENTAL:
- * bitmask calculation for recipients headers structures
+/**
+   /details RecipientFlags bitmask calculation for RecipientRows
+   structure.
+
+   \param aRow pointer to the SRow structures with the properties to
+   pass to ModifyRecipients.
+
+   According to MS-OXCDATA 2.9.3.1 RecipientFlags structure, the bitmask
+   can be represented as the following:
+
+   0      3   4   5   6   7   8   9  10  11         15   16
+   +------+---+---+---+---+---+---+---+---+----------+---+
+   | Type | E | D | T | S | R | N | U | I | Reserved | O |
+   +------+---+---+---+---+---+---+---+---+----------+---+
+   
+   Type: (0x7 mask) 3-bit enumeration describing the Address Type (PR_ADDRTYPE)
+   E: (0x8)    Email address included (PR_SMTP_ADDRESS)
+   D: (0x10)   Display Name included (PR_DISPLAY_NAME)
+   T: (0x20)   Transmittable Display Name included (PR_TRANSMITTABLE_DISPLAY_NAME)
+   S: (0x40)   If Transmittable Display Name is the same than Display Name (D == T)
+   R: (0x80)   Different transport is responsible for delivery
+   N: (0x100)  Recipient does not support receiving Rich Text messages
+   U: (0x200)  If we are using Unicode properties
+   I: (0x400)  If Simple Display Name is included (PR_7BIT_DISPLAY_NAME)
+   Reserved:   Must be zero
+   O: (0x8000) Non-standard address type is used
+
+   The PidTag property to bitmask mapping was unclear for some
+   fields. mapiproxy between Outlook 2003 and Exchange 2010 has been
+   used for this purpose.
+
+   For further information about PidTagAddressType, refer to
+   [MS-OXCMAIL] section 2.1.1.9
+
+   \return uint16_t holding the RecipientFlags value. 0 is returned
+   when an inconsistency or a failure occurs
+
  */
-uint16_t mapi_recipients_bitmask(struct SRow *aRow)
+uint16_t mapi_recipients_RecipientFlags(struct SRow *aRow)
 {
 	uint16_t		bitmask;
 	struct SPropValue	*lpProp = NULL;
+	bool			unicode = false;
+	const char		*addrtype = NULL;
+	const char		*tmp = NULL;
+	const char		*display_name = NULL;
+	const char		*transmit_display_name = NULL;
 
+	/* Sanity Checks */
+	if (!aRow) return 0;
+
 	bitmask = 0;
 
-	/* recipient type: EXCHANGE or SMTP */
+	/* (Type) - 0x0 to 0x7: PR_ADDRTYPE */
 	lpProp = get_SPropValue_SRow(aRow, PR_ADDRTYPE);
 	if (lpProp && lpProp->value.lpszA) {
-		if (!strcmp("SMTP", lpProp->value.lpszA)) {
-			bitmask |= 0xB;
-		}
+		addrtype = lpProp->value.lpszA;
 	} else {
-		/* (Bit 8) doesn't seem to work if unset */
-		bitmask |= 0x81;
+		lpProp = get_SPropValue_SRow(aRow, PR_ADDRTYPE_UNICODE);
+		if (lpProp && lpProp->value.lpszW) {
+			unicode = true;
+			addrtype = lpProp->value.lpszW;
+		} 
 	}
 
-	/* Bit 15: DISPLAY_NAME */
-	lpProp = get_SPropValue_SRow(aRow, PR_DISPLAY_NAME);
-	if (lpProp && lpProp->value.lpszA) {
-		bitmask |= 0x400;
+	if (!addrtype) {
+		return 0;
 	}
+	/* WARNING: This check is yet incomplete */
+	if (!strcmp("EX", addrtype)) { 
+		bitmask |= 0x1;
+	} else if (!strcmp("SMTP", addrtype)) {
+		bitmask |= 0x3;
+	}
 
-	lpProp = get_SPropValue_SRow(aRow, PR_DISPLAY_NAME_UNICODE);
-	if (lpProp && lpProp->value.lpszW) {
-		bitmask |= 0x600;
+	/* (E) - 0x8: PR_SMTP_ADDRESS (If we have Exchange type, we don't need it) */
+	if (strcmp(addrtype, "EX")) {
+		lpProp = get_SPropValue_SRow(aRow, (unicode == true) ? PR_SMTP_ADDRESS_UNICODE: PR_SMTP_ADDRESS);
+		if (lpProp) {
+			tmp = (unicode == true) ? lpProp->value.lpszW : lpProp->value.lpszA;
+			if (tmp) {
+				bitmask |= 0x8;
+			}
+		}
 	}
 
-	/* Bit 6: PR_GIVEN_NAME */
-	lpProp = get_SPropValue_SRow(aRow, PR_GIVEN_NAME);
-	if (lpProp && lpProp->value.lpszA) {
-		bitmask |= 0x20;
+	/* (D) - 0x10: PR_DISPLAY_NAME */
+	lpProp = get_SPropValue_SRow(aRow, (unicode == true) ? PR_DISPLAY_NAME_UNICODE : PR_DISPLAY_NAME);
+	if (lpProp) {
+		display_name = (unicode == true) ? lpProp->value.lpszW : lpProp->value.lpszA;
+		if (display_name) {
+			bitmask |= 0x10;
+		}
 	}
 
-	lpProp = get_SPropValue_SRow(aRow, PR_GIVEN_NAME_UNICODE);
-	if (lpProp && lpProp->value.lpszW) {
-		bitmask |= 0x220;
+	/* (T) - 0x20: PR_TRANSMITTABLE_DISPLAY_NAME */
+	lpProp = get_SPropValue_SRow(aRow, (unicode == true) ? PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE : PR_TRANSMITTABLE_DISPLAY_NAME);
+	if (lpProp) {
+		transmit_display_name = (unicode == true) ? lpProp->value.lpszW : lpProp->value.lpszA;
+		if (transmit_display_name) {
+			if (!display_name) {
+				bitmask |= 0x20;
+			} else if (display_name && strcmp(display_name, transmit_display_name)) {
+				bitmask |= 0x20;
+			}
+		}
 	}
 
-	/* Bit 5. PR_7BIT_DISPLAY_NAME */
-	lpProp = get_SPropValue_SRow(aRow, PR_7BIT_DISPLAY_NAME);
-	if (lpProp && lpProp->value.lpszA) {
-		bitmask |= 0x10;
+	/* (S) - 0x40: Does D equals T? If so, we shouldn't include PR_TRANSMITTABLE_DISPLAY_NAME within RecipientRows */
+	if (display_name && transmit_display_name) {
+		if (!strcmp(display_name, transmit_display_name)) {
+			bitmask |= 0x40;
+		}
 	}
 
-	lpProp = get_SPropValue_SRow(aRow, PR_7BIT_DISPLAY_NAME_UNICODE);
-	if (lpProp && lpProp->value.lpszW) {
-		bitmask |= 0x210;
+	/* (R) - 0x80: Different transport is responsible for delivery */
+	if (addrtype && strcmp(addrtype, "EX")) {
+		bitmask |= 0x80;
 	}
 
-	/* Bit 4: PR_EMAIL_ADDRESS */
-	if (bitmask & 0xA) {
-		lpProp = get_SPropValue_SRow(aRow, PR_SMTP_ADDRESS);
-		if (lpProp && lpProp->value.lpszA) {
-			bitmask |= 0x8;
+	/* (N) - 0x100: Recipient doesn't support rich-text messages */
+	lpProp = get_SPropValue_SRow(aRow, PR_SEND_RICH_INFO);
+	if (lpProp && (lpProp->value.b == false)) {
+		bitmask |= 0x100;
+	}
+
+	/* (U) - 0x200: Unicode properties */
+	if (unicode == true) {
+		bitmask |= 0x200;
+	}
+
+	/* (I) - 0x400: PR_7BIT_DISPLAY_NAME */
+	lpProp = get_SPropValue_SRow(aRow, (unicode == true) ? PR_7BIT_DISPLAY_NAME_UNICODE : PR_7BIT_DISPLAY_NAME);
+	if (lpProp) {
+		tmp = (unicode == true) ? lpProp->value.lpszW : lpProp->value.lpszA;
+		if (tmp) {
+			bitmask |= 0x400;
 		}
-		
-		lpProp = get_SPropValue_SRow(aRow, PR_SMTP_ADDRESS_UNICODE);
-		if (lpProp && lpProp->value.lpszW) {
-			bitmask |= 0x208;
-		}
 	}
 
 	return bitmask;
@@ -658,16 +730,25 @@
 	 */
 	request.properties = get_MAPITAGS_SRow(mem_ctx, &SRowSet->aRow[0]);
 	count = SRowSet->aRow[0].cValues - 1;
- 	request.prop_count = MAPITAGS_delete_entries(request.properties, count, 7,
+ 	request.prop_count = MAPITAGS_delete_entries(request.properties, count, 0x17,
+						     PR_ENTRYID,
 						     PR_DISPLAY_NAME,
 						     PR_DISPLAY_NAME_UNICODE,
+						     PR_DISPLAY_NAME_ERROR,
 						     PR_GIVEN_NAME,
 						     PR_GIVEN_NAME_UNICODE,
 						     PR_GIVEN_NAME_ERROR,
+						     PR_EMAIL_ADDRESS,
+						     PR_EMAIL_ADDRESS_UNICODE,
+						     PR_TRANSMITTABLE_DISPLAY_NAME,
+						     PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
 						     PR_RECIPIENT_TYPE,
-						     PR_ADDRTYPE);
+						     PR_ADDRTYPE,
+						     PR_ADDRTYPE_UNICODE,
+						     PR_ADDRTYPE_ERROR,
+						     PR_SEND_INTERNET_ENCODING,
+						     PR_SEND_INTERNET_ENCODING_ERROR);
 	size += request.prop_count * sizeof(uint32_t);
-
 	request.cValues = SRowSet->cRows;
 	size += sizeof(uint16_t);
 	request.RecipientRow = talloc_array(mem_ctx, struct ModifyRecipientRow, request.cValues);
@@ -693,77 +774,86 @@
 		request.RecipientRow[i_recip].RecipClass = (enum ulRecipClass) *RecipClass;
 		size += sizeof(uint8_t);
 		
-		RecipientRow->RecipientFlags = mapi_recipients_bitmask(aRow);
+		RecipientRow->RecipientFlags = mapi_recipients_RecipientFlags(aRow);
 		
-		/* recipient type EXCHANGE or SMTP */
-		switch (RecipientRow->RecipientFlags & 0xB) {
+		/* (Type) - 0x0 to 0x7: Recipient type (Exchange, SMTP or other?) */
+		switch (RecipientRow->RecipientFlags & 0x7) {
 		case 0x1: 
-			RecipientRow->type.EXCHANGE.organization_length = mapi_recipients_get_org_length(session->profile);
+		  //			RecipientRow->type.EXCHANGE.organization_length = mapi_recipients_get_org_length(session->profile);
+			RecipientRow->type.EXCHANGE.organization_length = 0;
 			RecipientRow->type.EXCHANGE.addr_type = SINGLE_RECIPIENT;
-			RecipientRow->type.EXCHANGE.username = (const char *) find_SPropValue_data(aRow, PR_7BIT_DISPLAY_NAME);
+			switch (RecipientRow->RecipientFlags & 0x200) {
+			case 0x0:
+				RecipientRow->type.EXCHANGE.username = (const char *) find_SPropValue_data(aRow, PR_EMAIL_ADDRESS);
+				break;
+			case 0x200:
+				RecipientRow->type.EXCHANGE.username = (const char *) find_SPropValue_data(aRow, PR_EMAIL_ADDRESS_UNICODE);
+				break;
+			}
 			size += sizeof(uint32_t) + strlen(RecipientRow->type.EXCHANGE.username) + 1;
 			break;
-		case 0xB:
+		case 0x3:
 			size += sizeof(uint16_t);
 			break;
 		}
-		
-		/* Bit 15: PR_DISPLAY_NAME */
-		switch(RecipientRow->RecipientFlags & 0x600) {
-		case (0x400):
-			RecipientRow->SimpleDisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_DISPLAY_NAME);
-			size += strlen(RecipientRow->SimpleDisplayName.lpszA) + 1;
-			break;
-		case (0x600):
-			RecipientRow->SimpleDisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_DISPLAY_NAME_UNICODE);
-			size += strlen(RecipientRow->SimpleDisplayName.lpszW) * 2 + 2;
-			break;
-		default:
-			break;
-		}
 
-		/* Bit 6: PR_GIVEN_NAME */
-		switch (RecipientRow->RecipientFlags & 0x220) {
-		case (0x20):
-			RecipientRow->TransmittableDisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_GIVEN_NAME);
-			size += strlen(RecipientRow->TransmittableDisplayName.lpszA) + 1;
+		/* (E) - 0x8: PR_SMTP_ADDRESS */
+		switch (RecipientRow->RecipientFlags & 0x208) {
+		case (0x8):
+			RecipientRow->EmailAddress.lpszA = (const char *) find_SPropValue_data(aRow, PR_SMTP_ADDRESS);
+			size += strlen(RecipientRow->EmailAddress.lpszA) + 1;
 			break;
-		case (0x220):
-			RecipientRow->TransmittableDisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_GIVEN_NAME_UNICODE);
-			size += strlen(RecipientRow->TransmittableDisplayName.lpszW) * 2 + 2;
+		case (0x208):
+			RecipientRow->EmailAddress.lpszW = (const char *) find_SPropValue_data(aRow, PR_SMTP_ADDRESS_UNICODE);
+			size += strlen(RecipientRow->EmailAddress.lpszW) * 2 + 2;
 			break;
 		default:
 			break;
 		}
 
-		/* Bit 5: PR_7BIT_DISPLAY_NAME */
+		/* (D) - 0x10: PR_DISPLAY_NAME */
 		switch (RecipientRow->RecipientFlags & 0x210) {
 		case (0x10):
-			RecipientRow->DisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_7BIT_DISPLAY_NAME);
+			RecipientRow->DisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_DISPLAY_NAME);
 			size += strlen(RecipientRow->DisplayName.lpszA) + 1;
 			break;
 		case (0x210):
-			RecipientRow->DisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_7BIT_DISPLAY_NAME_UNICODE);
+			RecipientRow->DisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_DISPLAY_NAME_UNICODE);
 			size += strlen(RecipientRow->DisplayName.lpszW) * 2 + 2;
 			break;
 		default:
 			break;
 		}
 
-		/* Bit 4: PR_SMTP_ADDRESS */
-		switch (RecipientRow->RecipientFlags & 0x208) {
-		case (0x8):
-			RecipientRow->EmailAddress.lpszA = (const char *) find_SPropValue_data(aRow, PR_SMTP_ADDRESS);
-			size += strlen(RecipientRow->EmailAddress.lpszA) + 1;
+		/* (T) - 0x20: PR_TRANSMITTABLE_DISPLAY_NAME */
+		switch (RecipientRow->RecipientFlags & 0x260) {
+		case (0x20):
+			RecipientRow->TransmittableDisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_TRANSMITTABLE_DISPLAY_NAME);
+			size += strlen(RecipientRow->TransmittableDisplayName.lpszA) + 1;
 			break;
-		case (0x208):
-			RecipientRow->EmailAddress.lpszW = (const char *) find_SPropValue_data(aRow, PR_SMTP_ADDRESS_UNICODE);
-			size += strlen(RecipientRow->EmailAddress.lpszW) * 2 + 2;
+		case (0x220):
+			RecipientRow->TransmittableDisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE);
+			size += strlen(RecipientRow->TransmittableDisplayName.lpszW) * 2 + 2;
 			break;
 		default:
 			break;
 		}
 		
+		
+		/* (I) - 0x400: PR_7BIT_DISPLAY_NAME */
+		switch(RecipientRow->RecipientFlags & 0x600) {
+		case (0x400):
+			RecipientRow->SimpleDisplayName.lpszA = (const char *) find_SPropValue_data(aRow, PR_7BIT_DISPLAY_NAME);
+			size += strlen(RecipientRow->SimpleDisplayName.lpszA) + 1;
+			break;
+		case (0x600):
+			RecipientRow->SimpleDisplayName.lpszW = (const char *) find_SPropValue_data(aRow, PR_7BIT_DISPLAY_NAME_UNICODE);
+			size += strlen(RecipientRow->SimpleDisplayName.lpszW) * 2 + 2;
+			break;
+		default:
+			break;
+		}
+
 		RecipientRow->prop_count = request.prop_count;
 		size += sizeof(uint16_t);
 		RecipientRow->layout = 0;
Index: exchange.idl
===================================================================
--- exchange.idl	(revision 1615)
+++ exchange.idl	(working copy)
@@ -1191,8 +1191,8 @@
 	} RecipSMTP;
 
 	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
-		[case(0x0)] RecipExchange	EXCHANGE;
-		[case(0xA)] RecipSMTP		SMTP;
+		[case(0x1)] RecipExchange	EXCHANGE;
+		[case(0x3)] RecipSMTP		SMTP;
 		[default];
 	} recipient_type;
 
@@ -1205,6 +1205,8 @@
 
 	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
 		[case(0x0)];
+		[case(0x60)];
+		[case(0x260)];
 		[case(0x20)] astring				lpszA;
 		[case(0x220)][flag(STR_NULLTERM)] string	lpszW;
 		[default];
@@ -1226,11 +1228,11 @@
 
 	typedef [flag(NDR_NOALIGN)] struct {
 		uint16									RecipientFlags;
-		[switch_is(RecipientFlags & 0xA)]   recipient_type			type;
+		[switch_is(RecipientFlags & 0x7)]   recipient_type			type;
 		[switch_is(RecipientFlags & 0x208)] recipient_EmailAddress	       	EmailAddress;
 		[switch_is(RecipientFlags & 0x210)] recipient_DisplayName		DisplayName;
 		[switch_is(RecipientFlags & 0x600)] recipient_SimpleDisplayName    	SimpleDisplayName;
-		[switch_is(RecipientFlags & 0x220)] recipient_TransmittableDisplayName	TransmittableDisplayName;
+		[switch_is(RecipientFlags & 0x260)] recipient_TransmittableDisplayName	TransmittableDisplayName;
 		uint16									prop_count;
 		uint8									layout;
 		[flag(NDR_REMAINING)] DATA_BLOB						prop_values;
Index: utils/mapitest/mapitest_common.c
===================================================================
--- utils/mapitest/mapitest_common.c	(revision 1615)
+++ utils/mapitest/mapitest_common.c	(working copy)
@@ -245,13 +245,17 @@
 	if (subject == NULL) return false;
 
 	/* Resolve recipients */
-	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0x6,
+	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0xA,
+					  PR_ENTRYID,
+					  PR_DISPLAY_NAME_UNICODE,
 					  PR_OBJECT_TYPE,
 					  PR_DISPLAY_TYPE,
-					  PR_7BIT_DISPLAY_NAME,
-					  PR_DISPLAY_NAME,
-					  PR_SMTP_ADDRESS,
-					  PR_GIVEN_NAME);
+					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
+					  PR_EMAIL_ADDRESS_UNICODE,
+					  PR_ADDRTYPE_UNICODE,
+					  PR_SEND_RICH_INFO,
+					  PR_7BIT_DISPLAY_NAME_UNICODE,
+					  PR_SMTP_ADDRESS_UNICODE);
 
 	username[0] = (const char *)mt->info.szDisplayName;
 	username[1] = NULL;
@@ -260,7 +264,7 @@
 	flaglist = talloc_zero(mt->mem_ctx, struct SPropTagArray);
 
 	retval = ResolveNames(mapi_object_get_session(obj_message), username, SPropTagArray, 
-			      &SRowSet, &flaglist, 0);
+			      &SRowSet, &flaglist, MAPI_UNICODE);
 	MAPIFreeBuffer(SPropTagArray);
 	if (retval != MAPI_E_SUCCESS) {
 		mapitest_print(mt, "* %-35s: 0x%.8x\n", "ResolveNames", GetLastError());
Index: utils/mapitest/modules/module_oxcmsg.c
===================================================================
--- utils/mapitest/modules/module_oxcmsg.c	(revision 1615)
+++ utils/mapitest/modules/module_oxcmsg.c	(working copy)
@@ -279,13 +279,17 @@
 
 
 	/* Step 4. Resolve the recipients and call ModifyRecipients */
-	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0x6,
+	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0xA,
+					  PR_ENTRYID,
+					  PR_DISPLAY_NAME_UNICODE,
 					  PR_OBJECT_TYPE,
 					  PR_DISPLAY_TYPE,
-					  PR_7BIT_DISPLAY_NAME,
-					  PR_DISPLAY_NAME,
-					  PR_SMTP_ADDRESS,
-					  PR_GIVEN_NAME);
+					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
+					  PR_EMAIL_ADDRESS_UNICODE,
+					  PR_ADDRTYPE_UNICODE,
+					  PR_SEND_RICH_INFO,
+					  PR_7BIT_DISPLAY_NAME_UNICODE,
+					  PR_SMTP_ADDRESS_UNICODE);
 
 	username = talloc_array(mt->mem_ctx, char *, 2);
 	username[0] = mt->info.szDisplayName;
@@ -293,7 +297,7 @@
 
 	retval = ResolveNames(mapi_object_get_session(&obj_message), 
 			      (const char **)username, SPropTagArray, 
-			      &SRowSet, &flaglist, 0);
+			      &SRowSet, &flaglist, MAPI_UNICODE);
 	mapitest_print_retval(mt, "ResolveNames");
 
 	SPropValue.ulPropTag = PR_SEND_INTERNET_ENCODING;
@@ -401,13 +405,17 @@
 		return false;
 	}
 
-	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0x6,
+	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0xA,
+					  PR_ENTRYID,
+					  PR_DISPLAY_NAME_UNICODE,
 					  PR_OBJECT_TYPE,
 					  PR_DISPLAY_TYPE,
-					  PR_7BIT_DISPLAY_NAME,
-					  PR_DISPLAY_NAME,
-					  PR_SMTP_ADDRESS,
-					  PR_GIVEN_NAME);
+					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
+					  PR_EMAIL_ADDRESS_UNICODE,
+					  PR_ADDRTYPE_UNICODE,
+					  PR_SEND_RICH_INFO,
+					  PR_7BIT_DISPLAY_NAME_UNICODE,
+					  PR_SMTP_ADDRESS_UNICODE);
 
 	username = talloc_array(mt->mem_ctx, char *, 2);
 	username[0] = mt->info.szDisplayName;
@@ -415,7 +423,7 @@
 
 	retval = ResolveNames(mapi_object_get_session(&obj_message),
 			      (const char **)username, SPropTagArray, 
-			      &SRowSet, &flaglist, 0);
+			      &SRowSet, &flaglist, MAPI_UNICODE);
 	mapitest_print_retval(mt, "ResolveNames");
 
 	SPropValue.ulPropTag = PR_SEND_INTERNET_ENCODING;
@@ -540,13 +548,17 @@
 		return false;
 	}
 
-	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0x6,
+	SPropTagArray = set_SPropTagArray(mt->mem_ctx, 0xA,
+					  PR_ENTRYID,
+					  PR_DISPLAY_NAME_UNICODE,
 					  PR_OBJECT_TYPE,
 					  PR_DISPLAY_TYPE,
-					  PR_7BIT_DISPLAY_NAME,
-					  PR_DISPLAY_NAME,
-					  PR_SMTP_ADDRESS,
-					  PR_GIVEN_NAME);
+					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
+					  PR_EMAIL_ADDRESS_UNICODE,
+					  PR_ADDRTYPE_UNICODE,
+					  PR_SEND_RICH_INFO,
+					  PR_7BIT_DISPLAY_NAME_UNICODE,
+					  PR_SMTP_ADDRESS_UNICODE);
 
 	username = talloc_array(mt->mem_ctx, char *, 2);
 	username[0] = mt->info.szDisplayName;
@@ -554,7 +566,7 @@
 
 	retval = ResolveNames(mapi_object_get_session(&obj_message),
 			      (const char **)username, SPropTagArray, 
-			      &SRowSet, &flaglist, 0);
+			      &SRowSet, &flaglist, MAPI_UNICODE);
 	mapitest_print_retval(mt, "ResolveNames");
 
 	SPropValue.ulPropTag = PR_SEND_INTERNET_ENCODING;
Index: utils/openchangeclient.c
===================================================================
--- utils/openchangeclient.c	(revision 1615)
+++ utils/openchangeclient.c	(working copy)
@@ -774,19 +774,23 @@
 	if (retval != MAPI_E_SUCCESS) return retval;
 
 	/* Recipients operations */
-	SPropTagArray = set_SPropTagArray(mem_ctx, 0x6,
+	SPropTagArray = set_SPropTagArray(mem_ctx, 0xA,
+					  PR_ENTRYID,
+					  PR_DISPLAY_NAME_UNICODE,
 					  PR_OBJECT_TYPE,
 					  PR_DISPLAY_TYPE,
-					  PR_7BIT_DISPLAY_NAME,
-					  PR_DISPLAY_NAME,
-					  PR_SMTP_ADDRESS,
-					  PR_GIVEN_NAME);
+					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
+					  PR_EMAIL_ADDRESS_UNICODE,
+					  PR_ADDRTYPE_UNICODE,
+					  PR_SEND_RICH_INFO,
+					  PR_7BIT_DISPLAY_NAME_UNICODE,
+					  PR_SMTP_ADDRESS_UNICODE);
 
 	oclient->usernames = collapse_recipients(mem_ctx, oclient);
 
 	/* ResolveNames */
 	retval = ResolveNames(mapi_object_get_session(&obj_message), (const char **)oclient->usernames, 
-			      SPropTagArray, &SRowSet, &flaglist, 0);
+			      SPropTagArray, &SRowSet, &flaglist, MAPI_UNICODE);
 	MAPIFreeBuffer(SPropTagArray);
 	if (retval != MAPI_E_SUCCESS) return retval;
 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to