[evolution-mapi] Bug #600389 - UTF8 characters in contacts not shown properly



commit 7e71d71b0cd0bcee7b6d8ad6c5a9420e6b21f567
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 13 20:20:04 2010 +0200

    Bug #600389 - UTF8 characters in contacts not shown properly

 .../exchange-mapi-account-setup.c                  |   12 +-
 src/addressbook/e-book-backend-mapi-gal.c          |   93 ++++----
 src/addressbook/e-book-backend-mapi.c              |  248 ++++++++++++--------
 src/calendar/e-cal-backend-mapi.c                  |  106 ++++++++-
 src/camel/camel-mapi-folder.c                      |   49 +---
 src/camel/camel-mapi-utils.c                       |   12 +-
 src/libexchangemapi/exchange-mapi-cal-utils.c      |   84 ++++----
 src/libexchangemapi/exchange-mapi-cal-utils.h      |   12 -
 src/libexchangemapi/exchange-mapi-connection.c     |   67 +++---
 9 files changed, 398 insertions(+), 285 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-setup.c b/src/account-setup-eplugin/exchange-mapi-account-setup.c
index 68566ca..c6a285e 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-setup.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-setup.c
@@ -116,7 +116,9 @@ create_profile_callback (struct SRowSet *rowset, gpointer data)
 
 	/* If we can find the exact username, then find & return its index. */
 	for (i = 0; i < rowset->cRows; i++) {
-		lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT);
+		lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT_UNICODE);
+		if (!lpProp_account)
+			lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT);
 
 		if (lpProp_account && lpProp_account->value.lpszA &&
 		    !g_strcmp0 (username, lpProp_account->value.lpszA))
@@ -151,8 +153,12 @@ create_profile_callback (struct SRowSet *rowset, gpointer data)
 	gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (store));
 
 	for (i = 0; i < rowset->cRows; i++) {
-		lpProp_fullname = get_SPropValue_SRow(&(rowset->aRow[i]), PR_DISPLAY_NAME);
-		lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT);
+		lpProp_fullname = get_SPropValue_SRow(&(rowset->aRow[i]), PR_DISPLAY_NAME_UNICODE);
+		if (!lpProp_fullname)
+			lpProp_fullname = get_SPropValue_SRow(&(rowset->aRow[i]), PR_DISPLAY_NAME);
+		lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT_UNICODE);
+		if (!lpProp_account)
+			lpProp_account = get_SPropValue_SRow(&(rowset->aRow[i]), PR_ACCOUNT);
 
 		if (lpProp_fullname && lpProp_fullname->value.lpszA &&
 		    lpProp_account && lpProp_account->value.lpszA) {
diff --git a/src/addressbook/e-book-backend-mapi-gal.c b/src/addressbook/e-book-backend-mapi-gal.c
index 7d66fe6..e209a11 100644
--- a/src/addressbook/e-book-backend-mapi-gal.c
+++ b/src/addressbook/e-book-backend-mapi-gal.c
@@ -42,51 +42,50 @@ static const struct field_element_mapping {
 
 	} mappings [] = {
 
-	{ E_CONTACT_UID, PT_STRING8, 0, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_UID, PT_UNICODE, 0, ELEMENT_TYPE_SIMPLE},
 	{ E_CONTACT_REV, PT_SYSTIME, PR_LAST_MODIFICATION_TIME, ELEMENT_TYPE_SIMPLE},
 
-	{ E_CONTACT_FILE_AS, PT_STRING8, PR_EMS_AB_MANAGER_T, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FULL_NAME, PT_STRING8, PR_DISPLAY_NAME, ELEMENT_TYPE_SIMPLE },
-	{ E_CONTACT_GIVEN_NAME, PT_STRING8, PR_GIVEN_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FAMILY_NAME, PT_STRING8, PR_SURNAME , ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_NICKNAME, PT_STRING8, PR_NICKNAME, ELEMENT_TYPE_SIMPLE },
-
-	{ E_CONTACT_EMAIL_1, PT_STRING8, PROP_TAG(PT_UNICODE, 0x8084), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_EMAIL_2, PT_STRING8, PROP_TAG(PT_UNICODE, 0x8094), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_EMAIL_3, PT_STRING8, PROP_TAG(PT_UNICODE, 0x80a4), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_IM_AIM,  PT_STRING8, PROP_TAG(PT_UNICODE, 0x8062), ELEMENT_TYPE_COMPLEX},
-
-	{ E_CONTACT_PHONE_BUSINESS, PT_STRING8, PR_OFFICE_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_HOME, PT_STRING8, PR_HOME_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_MOBILE, PT_STRING8, PR_MOBILE_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_HOME_FAX, PT_STRING8, PR_HOME_FAX_NUMBER ,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_BUSINESS_FAX, PT_STRING8, PR_BUSINESS_FAX_NUMBER,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_PAGER, PT_STRING8, PR_PAGER_TELEPHONE_NUMBER,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_ASSISTANT, PT_STRING8, PR_ASSISTANT_TELEPHONE_NUMBER ,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_COMPANY, PT_STRING8, PR_COMPANY_MAIN_PHONE_NUMBER ,ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_HOMEPAGE_URL, PT_STRING8, 0x802b001e, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FREEBUSY_URL, PT_STRING8, 0x80d8001e, ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_ROLE, PT_STRING8, PR_PROFESSION, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_TITLE, PT_STRING8, PR_TITLE, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ORG, PT_STRING8, PR_COMPANY_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ORG_UNIT, PT_STRING8, PR_DEPARTMENT_NAME,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_MANAGER, PT_STRING8, PR_MANAGER_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ASSISTANT, PT_STRING8, PR_ASSISTANT, ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_OFFICE, PT_STRING8, PR_OFFICE_LOCATION, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_SPOUSE, PT_STRING8, PR_SPOUSE_NAME, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FILE_AS, PT_UNICODE, PR_EMS_AB_MANAGER_T_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FULL_NAME, PT_UNICODE, PR_DISPLAY_NAME_UNICODE, ELEMENT_TYPE_SIMPLE },
+	{ E_CONTACT_GIVEN_NAME, PT_UNICODE, PR_GIVEN_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FAMILY_NAME, PT_UNICODE, PR_SURNAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_NICKNAME, PT_UNICODE, PR_NICKNAME_UNICODE, ELEMENT_TYPE_SIMPLE },
+
+	{ E_CONTACT_EMAIL_1, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8084), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_EMAIL_2, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8094), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_EMAIL_3, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x80a4), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_IM_AIM,  PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8062), ELEMENT_TYPE_COMPLEX},
+
+	{ E_CONTACT_PHONE_BUSINESS, PT_UNICODE, PR_OFFICE_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_HOME, PT_UNICODE, PR_HOME_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_MOBILE, PT_UNICODE, PR_MOBILE_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_HOME_FAX, PT_UNICODE, PR_HOME_FAX_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_BUSINESS_FAX, PT_UNICODE, PR_BUSINESS_FAX_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_PAGER, PT_UNICODE, PR_PAGER_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_ASSISTANT, PT_UNICODE, PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_COMPANY, PT_UNICODE, PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_HOMEPAGE_URL, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x802b), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FREEBUSY_URL, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x80d8), ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_ROLE, PT_UNICODE, PR_PROFESSION_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_TITLE, PT_UNICODE, PR_TITLE_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ORG, PT_UNICODE, PR_COMPANY_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ORG_UNIT, PT_UNICODE, PR_DEPARTMENT_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_MANAGER, PT_UNICODE, PR_MANAGER_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ASSISTANT, PT_UNICODE, PR_ASSISTANT_UNICODE, ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_OFFICE, PT_UNICODE, PR_OFFICE_LOCATION_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_SPOUSE, PT_UNICODE, PR_SPOUSE_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
 
 	{ E_CONTACT_BIRTH_DATE,  PT_SYSTIME, PR_BIRTHDAY, ELEMENT_TYPE_COMPLEX},
 	{ E_CONTACT_ANNIVERSARY, PT_SYSTIME, PR_WEDDING_ANNIVERSARY, ELEMENT_TYPE_COMPLEX},
 
-	{ E_CONTACT_NOTE, PT_STRING8, PR_BODY, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_NOTE, PT_UNICODE, PR_BODY_UNICODE, ELEMENT_TYPE_SIMPLE},
 
-	{ E_CONTACT_ADDRESS_HOME, PT_STRING8, 0x801a001e, ELEMENT_TYPE_COMPLEX},
-	{ E_CONTACT_ADDRESS_WORK, PT_STRING8, 0x801c001e, ELEMENT_TYPE_COMPLEX},
+	{ E_CONTACT_ADDRESS_HOME, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x801a), ELEMENT_TYPE_COMPLEX},
+	{ E_CONTACT_ADDRESS_WORK, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x801c), ELEMENT_TYPE_COMPLEX},
 //		{ E_CONTACT_BOOK_URI, ELEMENT_TYPE_SIMPLE, "book_uri"}
-//		{ E_CONTACT_EMAIL, PT_STRING8, 0x8084001e},
 //		{ E_CONTACT_CATEGORIES, },
 	};
 
@@ -561,8 +560,8 @@ emapidump_gal (struct SRow *gal_entry)
 		gpointer value;
 
 		/* can cast it, no writing to the value; and it'll be freed not before the end of this function */
-		value = (gpointer) find_SPropValue_data (gal_entry, mappings[i].mapi_id);
-		if (mappings[i].element_type == PT_STRING8 && mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
+		value = (gpointer) exchange_mapi_util_find_row_propval (gal_entry, mappings[i].mapi_id);
+		if (mappings[i].element_type == PT_UNICODE && mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
 			if (value)
 				e_contact_set (contact, mappings[i].field_id, value);
 		} else if (mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
@@ -681,8 +680,8 @@ build_restriction_emails_contains (struct mapi_SRestriction *res,
 
 	res->rt = RES_PROPERTY;
 	res->res.resProperty.relop = RES_PROPERTY;
-	res->res.resProperty.ulPropTag = 0x801f001e; /* EMAIL */
-	res->res.resProperty.lpProp.ulPropTag = 0x801f001e; /* EMAIL*/
+	res->res.resProperty.ulPropTag = PROP_TAG(PT_UNICODE, 0x801f); /* EMAIL */
+	res->res.resProperty.lpProp.ulPropTag = PROP_TAG(PT_UNICODE, 0x801f); /* EMAIL*/
 	res->res.resProperty.lpProp.value.lpszA = email;
 
 	return TRUE;
@@ -722,32 +721,32 @@ build_multiple_restriction_emails_contains (struct mapi_SRestriction *res,
 
 	or_res[0].rt = RES_CONTENT;
 	or_res[0].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[0].res.resContent.ulPropTag = PR_EMS_AB_MANAGER_T;
+	or_res[0].res.resContent.ulPropTag = PR_EMS_AB_MANAGER_T_UNICODE;
 	or_res[0].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[1].rt = RES_CONTENT;
 	or_res[1].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[1].res.resContent.ulPropTag = PR_DISPLAY_NAME;
+	or_res[1].res.resContent.ulPropTag = PR_DISPLAY_NAME_UNICODE;
 	or_res[1].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[2].rt = RES_CONTENT;
 	or_res[2].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[2].res.resContent.ulPropTag = PR_GIVEN_NAME;
+	or_res[2].res.resContent.ulPropTag = PR_GIVEN_NAME_UNICODE;
 	or_res[2].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[3].rt = RES_CONTENT;
 	or_res[3].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[3].res.resContent.ulPropTag = 0x8084001e;
+	or_res[3].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x8084);
 	or_res[3].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[4].rt = RES_CONTENT;
 	or_res[4].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[4].res.resContent.ulPropTag = 0x8094001e;
+	or_res[4].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x8094);
 	or_res[4].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[5].rt = RES_CONTENT;
 	or_res[5].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[5].res.resContent.ulPropTag = 0x80a4001e;
+	or_res[5].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x80a4);
 	or_res[5].res.resContent.lpProp.value.lpszA = email;
 
 	res = g_new0 (struct mapi_SRestriction, 1);
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 4c16034..2f2453d 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -75,6 +75,69 @@ struct _EBookBackendMAPIPrivate
 #define LOCK() g_mutex_lock (priv->lock)
 #define UNLOCK() g_mutex_unlock (priv->lock)
 
+/* this is a list of all known book MAPI tag IDs;
+   if you add new add it here too, otherwise it may not be fetched */
+static uint32_t known_book_mapi_ids[] = {
+	PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE,
+	PR_ASSISTANT_UNICODE,
+	PR_BIRTHDAY,
+	PR_BODY,
+	PR_BODY_UNICODE,
+	PR_BUSINESS_FAX_NUMBER_UNICODE,
+	PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE,
+	PR_COMPANY_NAME_UNICODE,
+	PR_COUNTRY_UNICODE,
+	PR_DEPARTMENT_NAME_UNICODE,
+	PR_DISPLAY_NAME_UNICODE,
+	PR_EMS_AB_MANAGER_T_UNICODE,
+	PR_FID,
+	PR_GIVEN_NAME_UNICODE,
+	PR_HASATTACH,
+	PR_HOME_ADDRESS_CITY_UNICODE,
+	PR_HOME_ADDRESS_COUNTRY_UNICODE,
+	PR_HOME_ADDRESS_POSTAL_CODE_UNICODE,
+	PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE,
+	PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE,
+	PR_HOME_FAX_NUMBER_UNICODE,
+	PR_HOME_TELEPHONE_NUMBER_UNICODE,
+	PR_INSTANCE_NUM,
+	PR_INST_ID,
+	PR_LAST_MODIFICATION_TIME,
+	PR_LOCALITY_UNICODE,
+	PR_MANAGER_NAME_UNICODE,
+	PR_MESSAGE_CLASS,
+	PR_MID,
+	PR_MOBILE_TELEPHONE_NUMBER_UNICODE,
+	PR_NICKNAME_UNICODE,
+	PR_NORMALIZED_SUBJECT_UNICODE,
+	PR_OFFICE_LOCATION_UNICODE,
+	PR_OFFICE_TELEPHONE_NUMBER_UNICODE,
+	PR_PAGER_TELEPHONE_NUMBER_UNICODE,
+	PR_POSTAL_CODE_UNICODE,
+	PR_POST_OFFICE_BOX_UNICODE,
+	PR_PROFESSION_UNICODE,
+	PR_RULE_MSG_NAME,
+	PR_RULE_MSG_PROVIDER,
+	PR_SPOUSE_NAME_UNICODE,
+	PR_STATE_OR_PROVINCE_UNICODE,
+	PR_SUBJECT_UNICODE,
+	PR_SURNAME_UNICODE,
+	PR_TITLE_UNICODE,
+	PR_WEDDING_ANNIVERSARY,
+	PROP_TAG(PT_UNICODE, 0x801a),
+	PROP_TAG(PT_UNICODE, 0x801c),
+	PROP_TAG(PT_UNICODE, 0x801f),
+	PROP_TAG(PT_UNICODE, 0x802b),
+	PROP_TAG(PT_UNICODE, 0x8062),
+	PROP_TAG(PT_UNICODE, 0x8084),
+	PROP_TAG(PT_UNICODE, 0x8093),
+	PROP_TAG(PT_UNICODE, 0x8094),
+	PROP_TAG(PT_UNICODE, 0x80a3),
+	PROP_TAG(PT_UNICODE, 0x80a4),
+	PROP_TAG(PT_UNICODE, 0x80d8),
+	PROP_TAG(PT_UNICODE, 0x812c)
+};
+
 #define ELEMENT_TYPE_SIMPLE 0x01
 #define ELEMENT_TYPE_COMPLEX 0x02 /* fields which require explicit functions to set values into EContact and EGwItem */
 
@@ -96,51 +159,50 @@ static const struct field_element_mapping {
 
 	} mappings [] = {
 
-	{ E_CONTACT_UID, PT_STRING8, 0, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_UID, PT_UNICODE, 0, ELEMENT_TYPE_SIMPLE},
 	{ E_CONTACT_REV, PT_SYSTIME, PR_LAST_MODIFICATION_TIME, ELEMENT_TYPE_SIMPLE},
 
-	{ E_CONTACT_FILE_AS, PT_STRING8, PR_EMS_AB_MANAGER_T, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FULL_NAME, PT_STRING8, PR_DISPLAY_NAME, ELEMENT_TYPE_SIMPLE },
-	{ E_CONTACT_GIVEN_NAME, PT_STRING8, PR_GIVEN_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FAMILY_NAME, PT_STRING8, PR_SURNAME , ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_NICKNAME, PT_STRING8, PR_NICKNAME, ELEMENT_TYPE_SIMPLE },
-
-	{ E_CONTACT_EMAIL_1, PT_STRING8, PROP_TAG(PT_STRING8, 0x8084), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_EMAIL_2, PT_STRING8, PROP_TAG(PT_STRING8, 0x8093), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_EMAIL_3, PT_STRING8, PROP_TAG(PT_STRING8, 0x80a3), ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_IM_AIM,  PT_STRING8, PROP_TAG(PT_UNICODE, 0x8062), ELEMENT_TYPE_COMPLEX},
-
-	{ E_CONTACT_PHONE_BUSINESS, PT_STRING8, PR_OFFICE_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_HOME, PT_STRING8, PR_HOME_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_MOBILE, PT_STRING8, PR_MOBILE_TELEPHONE_NUMBER, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_HOME_FAX, PT_STRING8, PR_HOME_FAX_NUMBER ,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_BUSINESS_FAX, PT_STRING8, PR_BUSINESS_FAX_NUMBER,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_PAGER, PT_STRING8, PR_PAGER_TELEPHONE_NUMBER,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_ASSISTANT, PT_STRING8, PR_ASSISTANT_TELEPHONE_NUMBER ,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_PHONE_COMPANY, PT_STRING8, PR_COMPANY_MAIN_PHONE_NUMBER ,ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_HOMEPAGE_URL, PT_STRING8, 0x802b001e, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_FREEBUSY_URL, PT_STRING8, 0x80d8001e, ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_ROLE, PT_STRING8, PR_PROFESSION, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_TITLE, PT_STRING8, PR_TITLE, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ORG, PT_STRING8, PR_COMPANY_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ORG_UNIT, PT_STRING8, PR_DEPARTMENT_NAME,ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_MANAGER, PT_STRING8, PR_MANAGER_NAME, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_ASSISTANT, PT_STRING8, PR_ASSISTANT, ELEMENT_TYPE_SIMPLE},
-
-	{ E_CONTACT_OFFICE, PT_STRING8, PR_OFFICE_LOCATION, ELEMENT_TYPE_SIMPLE},
-	{ E_CONTACT_SPOUSE, PT_STRING8, PR_SPOUSE_NAME, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FILE_AS, PT_UNICODE, PR_EMS_AB_MANAGER_T_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FULL_NAME, PT_UNICODE, PR_DISPLAY_NAME_UNICODE, ELEMENT_TYPE_SIMPLE },
+	{ E_CONTACT_GIVEN_NAME, PT_UNICODE, PR_GIVEN_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FAMILY_NAME, PT_UNICODE, PR_SURNAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_NICKNAME, PT_UNICODE, PR_NICKNAME_UNICODE, ELEMENT_TYPE_SIMPLE },
+
+	{ E_CONTACT_EMAIL_1, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8084), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_EMAIL_2, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8093), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_EMAIL_3, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x80a3), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_IM_AIM,  PT_UNICODE, PROP_TAG(PT_UNICODE, 0x8062), ELEMENT_TYPE_COMPLEX},
+
+	{ E_CONTACT_PHONE_BUSINESS, PT_UNICODE, PR_OFFICE_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_HOME, PT_UNICODE, PR_HOME_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_MOBILE, PT_UNICODE, PR_MOBILE_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_HOME_FAX, PT_UNICODE, PR_HOME_FAX_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_BUSINESS_FAX, PT_UNICODE, PR_BUSINESS_FAX_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_PAGER, PT_UNICODE, PR_PAGER_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_ASSISTANT, PT_UNICODE, PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_PHONE_COMPANY, PT_UNICODE, PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE, ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_HOMEPAGE_URL, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x802b), ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_FREEBUSY_URL, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x80d8), ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_ROLE, PT_UNICODE, PR_PROFESSION_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_TITLE, PT_UNICODE, PR_TITLE_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ORG, PT_UNICODE, PR_COMPANY_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ORG_UNIT, PT_UNICODE, PR_DEPARTMENT_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_MANAGER, PT_UNICODE, PR_MANAGER_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_ASSISTANT, PT_UNICODE, PR_ASSISTANT_UNICODE, ELEMENT_TYPE_SIMPLE},
+
+	{ E_CONTACT_OFFICE, PT_UNICODE, PR_OFFICE_LOCATION_UNICODE, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_SPOUSE, PT_UNICODE, PR_SPOUSE_NAME_UNICODE, ELEMENT_TYPE_SIMPLE},
 
 	{ E_CONTACT_BIRTH_DATE,  PT_SYSTIME, PR_BIRTHDAY, ELEMENT_TYPE_COMPLEX},
 	{ E_CONTACT_ANNIVERSARY, PT_SYSTIME, PR_WEDDING_ANNIVERSARY, ELEMENT_TYPE_COMPLEX},
 
-	{ E_CONTACT_NOTE, PT_STRING8, PR_BODY, ELEMENT_TYPE_SIMPLE},
+	{ E_CONTACT_NOTE, PT_UNICODE, PR_BODY_UNICODE, ELEMENT_TYPE_SIMPLE},
 
-	{ E_CONTACT_ADDRESS_HOME, PT_STRING8, 0x801a001e, ELEMENT_TYPE_COMPLEX},
-	{ E_CONTACT_ADDRESS_WORK, PT_STRING8, 0x801c001e, ELEMENT_TYPE_COMPLEX},
+	{ E_CONTACT_ADDRESS_HOME, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x801a), ELEMENT_TYPE_COMPLEX},
+	{ E_CONTACT_ADDRESS_WORK, PT_UNICODE, PROP_TAG(PT_UNICODE, 0x801c), ELEMENT_TYPE_COMPLEX},
 //		{ E_CONTACT_BOOK_URI, ELEMENT_TYPE_SIMPLE, "book_uri"}
-//		{ E_CONTACT_EMAIL, PT_STRING8, 0x8084001e},
 //		{ E_CONTACT_CATEGORIES, },
 	};
 
@@ -211,8 +273,8 @@ build_restriction_emails_contains (struct mapi_SRestriction *res,
 
 	res->rt = RES_PROPERTY;
 	res->res.resProperty.relop = RES_PROPERTY;
-	res->res.resProperty.ulPropTag = 0x801f001e; /* EMAIL */
-	res->res.resProperty.lpProp.ulPropTag = 0x801f001e; /* EMAIL*/
+	res->res.resProperty.ulPropTag = PROP_TAG(PT_UNICODE, 0x801f); /* EMAIL */
+	res->res.resProperty.lpProp.ulPropTag = PROP_TAG(PT_UNICODE, 0x801f); /* EMAIL*/
 	res->res.resProperty.lpProp.value.lpszA = email;
 
 	return TRUE;
@@ -251,32 +313,32 @@ build_multiple_restriction_emails_contains (struct mapi_SRestriction *res,
 
 	or_res[0].rt = RES_CONTENT;
 	or_res[0].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[0].res.resContent.ulPropTag = PR_EMS_AB_MANAGER_T;
+	or_res[0].res.resContent.ulPropTag = PR_EMS_AB_MANAGER_T_UNICODE;
 	or_res[0].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[1].rt = RES_CONTENT;
 	or_res[1].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[1].res.resContent.ulPropTag = PR_DISPLAY_NAME;
+	or_res[1].res.resContent.ulPropTag = PR_DISPLAY_NAME_UNICODE;
 	or_res[1].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[2].rt = RES_CONTENT;
 	or_res[2].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[2].res.resContent.ulPropTag = PR_GIVEN_NAME;
+	or_res[2].res.resContent.ulPropTag = PR_GIVEN_NAME_UNICODE;
 	or_res[2].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[3].rt = RES_CONTENT;
 	or_res[3].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[3].res.resContent.ulPropTag = 0x8084001e;
+	or_res[3].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x8084);
 	or_res[3].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[4].rt = RES_CONTENT;
 	or_res[4].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[4].res.resContent.ulPropTag = 0x8094001e;
+	or_res[4].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x8094);
 	or_res[4].res.resContent.lpProp.value.lpszA = email;
 
 	or_res[5].rt = RES_CONTENT;
 	or_res[5].res.resContent.fuzzy = FL_FULLSTRING | FL_IGNORECASE;
-	or_res[5].res.resContent.ulPropTag = 0x80a4001e;
+	or_res[5].res.resContent.ulPropTag = PROP_TAG(PT_UNICODE, 0x80a4);
 	or_res[5].res.resContent.lpProp.value.lpszA = email;
 
 	res = g_new0 (struct mapi_SRestriction, 1);
@@ -458,9 +520,9 @@ mapi_book_build_props (struct SPropValue ** value, struct SPropTagArray * SPropT
 	props = g_new0 (struct SPropValue, 50); //FIXME: Correct value tbd
 	set_str_value ( E_CONTACT_FILE_AS, SPropTagArray->aulPropTag[0]);
 
-	set_str_value (E_CONTACT_FULL_NAME, PR_DISPLAY_NAME);
+	set_str_value (E_CONTACT_FULL_NAME, PR_DISPLAY_NAME_UNICODE);
 	set_SPropValue_proptag(&props[i++], PR_MESSAGE_CLASS, (gconstpointer )IPM_CONTACT);
-	set_str_value (E_CONTACT_FILE_AS, PR_NORMALIZED_SUBJECT);
+	set_str_value (E_CONTACT_FILE_AS, PR_NORMALIZED_SUBJECT_UNICODE);
 	set_str_value (E_CONTACT_EMAIL_1,  SPropTagArray->aulPropTag[1]);
 //	set_str_value (E_CONTACT_EMAIL_1,  SPropTagArray->aulPropTag[2]);
 	set_str_value (E_CONTACT_FILE_AS,  SPropTagArray->aulPropTag[5]);
@@ -473,28 +535,28 @@ mapi_book_build_props (struct SPropValue ** value, struct SPropTagArray * SPropT
 //	set_str_value ( E_CONTACT_EMAIL_3, SPropTagArray->aulPropTag[12]);
 
 	set_str_value (E_CONTACT_HOMEPAGE_URL, SPropTagArray->aulPropTag[6]);
-	set_str_value (E_CONTACT_FREEBUSY_URL, 0x812C001E);
+	set_str_value (E_CONTACT_FREEBUSY_URL, PROP_TAG(PT_UNICODE, 0x812c));
 
-	set_str_value ( E_CONTACT_PHONE_BUSINESS, PR_OFFICE_TELEPHONE_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_HOME, PR_HOME_TELEPHONE_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_MOBILE, PR_MOBILE_TELEPHONE_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_HOME_FAX, PR_HOME_FAX_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_BUSINESS_FAX, PR_BUSINESS_FAX_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_PAGER, PR_PAGER_TELEPHONE_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_ASSISTANT, PR_ASSISTANT_TELEPHONE_NUMBER);
-	set_str_value ( E_CONTACT_PHONE_COMPANY, PR_COMPANY_MAIN_PHONE_NUMBER);
+	set_str_value ( E_CONTACT_PHONE_BUSINESS, PR_OFFICE_TELEPHONE_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_HOME, PR_HOME_TELEPHONE_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_MOBILE, PR_MOBILE_TELEPHONE_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_HOME_FAX, PR_HOME_FAX_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_BUSINESS_FAX, PR_BUSINESS_FAX_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_PAGER, PR_PAGER_TELEPHONE_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_ASSISTANT, PR_ASSISTANT_TELEPHONE_NUMBER_UNICODE);
+	set_str_value ( E_CONTACT_PHONE_COMPANY, PR_COMPANY_MAIN_PHONE_NUMBER_UNICODE);
 
-	set_str_value (E_CONTACT_MANAGER, PR_MANAGER_NAME);
-	set_str_value (E_CONTACT_ASSISTANT, PR_ASSISTANT);
-	set_str_value (E_CONTACT_ORG, PR_COMPANY_NAME);
-	set_str_value (E_CONTACT_ORG_UNIT, PR_DEPARTMENT_NAME);
-	set_str_value (E_CONTACT_ROLE, PR_PROFESSION);
-	set_str_value (E_CONTACT_TITLE, PR_TITLE);
+	set_str_value (E_CONTACT_MANAGER, PR_MANAGER_NAME_UNICODE);
+	set_str_value (E_CONTACT_ASSISTANT, PR_ASSISTANT_UNICODE);
+	set_str_value (E_CONTACT_ORG, PR_COMPANY_NAME_UNICODE);
+	set_str_value (E_CONTACT_ORG_UNIT, PR_DEPARTMENT_NAME_UNICODE);
+	set_str_value (E_CONTACT_ROLE, PR_PROFESSION_UNICODE);
+	set_str_value (E_CONTACT_TITLE, PR_TITLE_UNICODE);
 
-	set_str_value (E_CONTACT_OFFICE, PR_OFFICE_LOCATION);
-	set_str_value (E_CONTACT_SPOUSE, PR_SPOUSE_NAME);
+	set_str_value (E_CONTACT_OFFICE, PR_OFFICE_LOCATION_UNICODE);
+	set_str_value (E_CONTACT_SPOUSE, PR_SPOUSE_NAME_UNICODE);
 
-	set_str_value (E_CONTACT_NOTE, PR_BODY);
+	set_str_value (E_CONTACT_NOTE, PR_BODY_UNICODE);
 
 	//BDAY AND ANNV
 	if (e_contact_get (contact, E_CONTACT_BIRTH_DATE)) {
@@ -540,11 +602,11 @@ mapi_book_build_props (struct SPropValue ** value, struct SPropTagArray * SPropT
 
 		contact_addr = e_contact_get (contact, E_CONTACT_ADDRESS_HOME);
 		set_SPropValue_proptag (&props[i++], SPropTagArray->aulPropTag[8], contact_addr->street);
-		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_POST_OFFICE_BOX, contact_addr->ext);
-		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_CITY, contact_addr->locality);
-		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_STATE_OR_PROVINCE, contact_addr->region);
-		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_POSTAL_CODE, contact_addr->code);
-		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_COUNTRY, contact_addr->country);
+		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE, contact_addr->ext);
+		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_CITY_UNICODE, contact_addr->locality);
+		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE, contact_addr->region);
+		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_POSTAL_CODE_UNICODE, contact_addr->code);
+		set_SPropValue_proptag (&props[i++], PR_HOME_ADDRESS_COUNTRY_UNICODE, contact_addr->country);
 	}
 
 	if (e_contact_get (contact, E_CONTACT_ADDRESS_WORK)) {
@@ -552,11 +614,11 @@ mapi_book_build_props (struct SPropValue ** value, struct SPropTagArray * SPropT
 
 		contact_addr = e_contact_get (contact, E_CONTACT_ADDRESS_WORK);
 		set_SPropValue_proptag (&props[i++], SPropTagArray->aulPropTag[9], contact_addr->street);
-		set_SPropValue_proptag (&props[i++], PR_POST_OFFICE_BOX, contact_addr->ext);
-		set_SPropValue_proptag (&props[i++], PR_LOCALITY, contact_addr->locality);
-		set_SPropValue_proptag (&props[i++], PR_STATE_OR_PROVINCE, contact_addr->region);
-		set_SPropValue_proptag (&props[i++], PR_POSTAL_CODE, contact_addr->code);
-		set_SPropValue_proptag (&props[i++], PR_COUNTRY, contact_addr->country);
+		set_SPropValue_proptag (&props[i++], PR_POST_OFFICE_BOX_UNICODE, contact_addr->ext);
+		set_SPropValue_proptag (&props[i++], PR_LOCALITY_UNICODE, contact_addr->locality);
+		set_SPropValue_proptag (&props[i++], PR_STATE_OR_PROVINCE_UNICODE, contact_addr->region);
+		set_SPropValue_proptag (&props[i++], PR_POSTAL_CODE_UNICODE, contact_addr->code);
+		set_SPropValue_proptag (&props[i++], PR_COUNTRY_UNICODE, contact_addr->country);
 	}
 
 //	set_str_value (E_CONTACT_NICKNAME, SPropTagArray->aulPropTag[10]);
@@ -816,7 +878,7 @@ e_book_backend_mapi_get_contact (EBookBackend *backend,
 
 			exchange_mapi_util_mapi_ids_from_uid (id, &fid, &mid);
 			exchange_mapi_connection_fetch_item (priv->conn, priv->fid, mid,
-							NULL, 0,
+							known_book_mapi_ids, G_N_ELEMENTS (known_book_mapi_ids),
 							NULL, NULL,
 							create_contact_item, contact,
 							MAPI_OPTIONS_FETCH_ALL);
@@ -883,7 +945,7 @@ static const uint32_t GetPropsList[] = {
 	PR_MID,
 	PR_INST_ID,
 	PR_INSTANCE_NUM,
-	PR_SUBJECT,
+	PR_SUBJECT_UNICODE,
 	PR_MESSAGE_CLASS,
 	PR_HASATTACH,
 /* FIXME: is this tag fit to check if a recipient table exists or not ? */
@@ -896,7 +958,7 @@ static const uint16_t n_GetPropsList = G_N_ELEMENTS (GetPropsList);
 gboolean
 mapi_book_build_name_id_for_getprops (struct mapi_nameid *nameid, gpointer data)
 {
-	mapi_nameid_lid_add(nameid, 0x8084, PSETID_Address); /* PT_STRING8 - EmailOriginalDisplayName */
+	mapi_nameid_lid_add(nameid, 0x8084, PSETID_Address); /* PT_UNICODE - EmailOriginalDisplayName */
 //	mapi_nameid_lid_add(nameid, 0x8020, PSETID_Address);
 //	mapi_nameid_lid_add(nameid, 0x8021, PSETID_Address);
 	mapi_nameid_lid_add(nameid, 0x8094, PSETID_Address);
@@ -1034,8 +1096,8 @@ emapidump_contact(struct mapi_SPropValue_array *properties)
 		gpointer value;
 
 		/* can cast it, no writing to the value; and it'll be freed not before the end of this function */
-		value = (gpointer) find_mapi_SPropValue_data (properties, mappings[i].mapi_id);
-		if (mappings[i].element_type == PT_STRING8 && mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
+		value = (gpointer) exchange_mapi_util_find_array_propval (properties, mappings[i].mapi_id);
+		if (mappings[i].element_type == PT_UNICODE && mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
 			if (value)
 				e_contact_set (contact, mappings[i].field_id, value);
 		} else if (mappings[i].contact_type == ELEMENT_TYPE_SIMPLE) {
@@ -1088,20 +1150,20 @@ emapidump_contact(struct mapi_SPropValue_array *properties)
 					contact_addr.address_format = NULL;
 					contact_addr.po = NULL;
 					contact_addr.street = (gchar *)value;
-					contact_addr.ext = (gchar *)find_mapi_SPropValue_data (properties, PR_HOME_ADDRESS_POST_OFFICE_BOX);
-					contact_addr.locality = (gchar *)find_mapi_SPropValue_data (properties, PR_HOME_ADDRESS_CITY);
-					contact_addr.region = (gchar *)find_mapi_SPropValue_data (properties, PR_HOME_ADDRESS_STATE_OR_PROVINCE);
-					contact_addr.code = (gchar *)find_mapi_SPropValue_data (properties, PR_HOME_ADDRESS_POSTAL_CODE);
-					contact_addr.country = (gchar *)find_mapi_SPropValue_data (properties, PR_HOME_ADDRESS_COUNTRY);
+					contact_addr.ext = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_HOME_ADDRESS_POST_OFFICE_BOX_UNICODE);
+					contact_addr.locality = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_HOME_ADDRESS_CITY_UNICODE);
+					contact_addr.region = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_HOME_ADDRESS_STATE_OR_PROVINCE_UNICODE);
+					contact_addr.code = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_HOME_ADDRESS_POSTAL_CODE_UNICODE);
+					contact_addr.country = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_HOME_ADDRESS_COUNTRY_UNICODE);
 				} else {
 					contact_addr.address_format = NULL;
 					contact_addr.po = NULL;
 					contact_addr.street = (gchar *)value;
-					contact_addr.ext = (gchar *)find_mapi_SPropValue_data (properties, PR_POST_OFFICE_BOX);
-					contact_addr.locality = (gchar *)find_mapi_SPropValue_data (properties, PR_LOCALITY);
-					contact_addr.region = (gchar *)find_mapi_SPropValue_data (properties, PR_STATE_OR_PROVINCE);
-					contact_addr.code = (gchar *)find_mapi_SPropValue_data (properties, PR_POSTAL_CODE);
-					contact_addr.country = (gchar *)find_mapi_SPropValue_data (properties, PR_COUNTRY);
+					contact_addr.ext = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_POST_OFFICE_BOX_UNICODE);
+					contact_addr.locality = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_LOCALITY_UNICODE);
+					contact_addr.region = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_STATE_OR_PROVINCE_UNICODE);
+					contact_addr.code = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_POSTAL_CODE_UNICODE);
+					contact_addr.country = (gchar *)exchange_mapi_util_find_array_propval (properties, PR_COUNTRY_UNICODE);
 				}
 				e_contact_set (contact, mappings[i].field_id, &contact_addr);
 			}
@@ -1325,7 +1387,7 @@ book_view_thread (gpointer data)
 			}
 		} else {
 			if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, NULL, NULL,
-							NULL, 0,
+							known_book_mapi_ids, G_N_ELEMENTS (known_book_mapi_ids),
 							NULL, NULL,
 							create_contact_cb, book_view,
 							MAPI_OPTIONS_FETCH_ALL)) {
@@ -1432,7 +1494,7 @@ build_cache (EBookBackendMAPI *ebmapi)
 	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 
 	if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, NULL, NULL,
-						NULL, 0,
+						known_book_mapi_ids, G_N_ELEMENTS (known_book_mapi_ids),
 						NULL, NULL,
 						cache_contact_cb, ebmapi,
 						MAPI_OPTIONS_FETCH_ALL)) {
@@ -1477,7 +1539,7 @@ update_cache (EBookBackendMAPI *ebmapi)
 	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
 
 	if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, &res, NULL,
-						NULL, 0,
+						known_book_mapi_ids, G_N_ELEMENTS (known_book_mapi_ids),
 						NULL, NULL,
 						cache_contact_cb, ebmapi,
 						MAPI_OPTIONS_FETCH_ALL)) {
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 0edc26a..92976ce 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -92,6 +92,81 @@ struct _ECalBackendMAPIPrivate {
 	SyncDelta		*dlock;
 };
 
+/* this is a list of all known calendar MAPI tag IDs;
+   if you add new add it here too, otherwise it may not be fetched */
+static uint32_t known_cal_mapi_ids[] = {
+	PR_7BIT_DISPLAY_NAME_UNICODE,
+	PR_ADDRTYPE,
+	PR_ATTACH_DATA_BIN,
+	PR_ATTACH_FILENAME_UNICODE,
+	PR_ATTACH_LONG_FILENAME_UNICODE,
+	PR_ATTACH_METHOD,
+	PR_BODY,
+	PR_BODY_UNICODE,
+	PR_CONVERSATION_TOPIC_UNICODE,
+	PR_CREATION_TIME,
+	PR_DISPLAY_NAME_UNICODE,
+	PR_DISPLAY_TYPE,
+	PR_END_DATE,
+	PR_FID,
+	PR_GIVEN_NAME_UNICODE,
+	PR_HTML,
+	PR_ICON_INDEX,
+	PR_IMPORTANCE,
+	PR_LAST_MODIFICATION_TIME,
+	PR_MESSAGE_CLASS,
+	PR_MESSAGE_FLAGS,
+	PR_MID,
+	PR_MSG_EDITOR_FORMAT,
+	PR_NORMALIZED_SUBJECT_UNICODE,
+	PR_OBJECT_TYPE,
+	PR_OWNER_APPT_ID,
+	PR_PRIORITY,
+	PR_PROCESSED,
+	PR_RCVD_REPRESENTING_ADDRTYPE,
+	PR_RCVD_REPRESENTING_EMAIL_ADDRESS_UNICODE,
+	PR_RCVD_REPRESENTING_NAME_UNICODE,
+	PR_RECIPIENT_DISPLAY_NAME_UNICODE,
+	PR_RECIPIENTS_FLAGS,
+	PR_RECIPIENT_TRACKSTATUS,
+	PR_RECIPIENT_TYPE,
+	PR_RENDERING_POSITION,
+	PR_RESPONSE_REQUESTED,
+	PR_RTF_IN_SYNC,
+	PR_SENDER_ADDRTYPE,
+	PR_SENDER_EMAIL_ADDRESS_UNICODE,
+	PR_SENDER_NAME_UNICODE,
+	PR_SEND_INTERNET_ENCODING,
+	PR_SENSITIVITY,
+	PR_SENT_REPRESENTING_ADDRTYPE,
+	PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
+	PR_SENT_REPRESENTING_NAME_UNICODE,
+	PR_SMTP_ADDRESS_UNICODE,
+	PR_START_DATE,
+	PR_SUBJECT_UNICODE,
+	PROP_TAG(PT_BINARY, 0x0003),
+	PROP_TAG(PT_BINARY, 0x0023),
+	PROP_TAG(PT_BINARY, 0x8216),
+	PROP_TAG(PT_BINARY, 0x825E),
+	PROP_TAG(PT_BINARY, 0x825F),
+	PROP_TAG(PT_BOOLEAN, 0x8126),
+	PROP_TAG(PT_BOOLEAN, 0x8215),
+	PROP_TAG(PT_BOOLEAN, 0x8223),
+	PROP_TAG(PT_BOOLEAN, 0x8503),
+	PROP_TAG(PT_DOUBLE, 0x8102),
+	PROP_TAG(PT_LONG, 0x8101),
+	PROP_TAG(PT_LONG, 0x8201),
+	PROP_TAG(PT_LONG, 0x8205),
+	PROP_TAG(PT_STRING8, 0x8208),
+	PROP_TAG(PT_SYSTIME, 0x8104),
+	PROP_TAG(PT_SYSTIME, 0x8105),
+	PROP_TAG(PT_SYSTIME, 0x810F),
+	PROP_TAG(PT_SYSTIME, 0x820D),
+	PROP_TAG(PT_SYSTIME, 0x820E),
+	PROP_TAG(PT_SYSTIME, 0x8502),
+	PROP_TAG(PT_SYSTIME, 0x8560)
+};
+
 #define PARENT_TYPE E_TYPE_CAL_BACKEND_SYNC
 static ECalBackendClass *parent_class = NULL;
 
@@ -619,7 +694,7 @@ get_deltas (gpointer handle)
 	/* FIXME: GetProps does not seem to work for tasks :-( */
 	if (kind == ICAL_VTODO_COMPONENT) {
 		if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, use_restriction ? &res : NULL, NULL,
-						NULL, 0, NULL, NULL,
+						known_cal_mapi_ids, G_N_ELEMENTS (known_cal_mapi_ids), NULL, NULL,
 						mapi_cal_get_changes_cb, cbmapi,
 						MAPI_OPTIONS_FETCH_ALL)) {
 			/* FIXME: String : We need to restart evolution-data-server */
@@ -721,7 +796,7 @@ get_deltas (gpointer handle)
 
 		if (kind == ICAL_VTODO_COMPONENT) {
 			if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, &res, NULL,
-						NULL, 0, NULL, NULL,
+						known_cal_mapi_ids, G_N_ELEMENTS (known_cal_mapi_ids), NULL, NULL,
 						mapi_cal_get_changes_cb, cbmapi,
 						MAPI_OPTIONS_FETCH_ALL)) {
 				e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Error fetching changes from the server."));
@@ -1058,7 +1133,7 @@ populate_cache (ECalBackendMAPI *cbmapi)
 	/* FIXME: GetProps does not seem to work for tasks :-( */
 	if (kind == ICAL_VTODO_COMPONENT) {
 		if (!exchange_mapi_connection_fetch_items (priv->conn, priv->fid, NULL, NULL,
-						NULL, 0, NULL, NULL,
+						known_cal_mapi_ids, G_N_ELEMENTS (known_cal_mapi_ids), NULL, NULL,
 						mapi_cal_cache_create_cb, cbmapi,
 						MAPI_OPTIONS_FETCH_ALL)) {
 			e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Could not create cache file"));
@@ -1313,6 +1388,19 @@ e_cal_backend_mapi_open (ECalBackendSync *backend, EDataCal *cal, gboolean only_
 		return status;
 }
 
+static uint32_t req_props_list[] = {
+	PR_OWNER_APPT_ID,
+	PROP_TAG(PT_LONG, 0x8201),
+	PROP_TAG(PT_BINARY, 0x0023),
+	PROP_TAG(PT_BINARY, 0x0003),
+	PR_SENT_REPRESENTING_NAME_UNICODE,
+	PR_SENT_REPRESENTING_ADDRTYPE,
+	PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
+	PR_SENDER_NAME_UNICODE,
+	PR_SENDER_ADDRTYPE,
+	PR_SENDER_EMAIL_ADDRESS_UNICODE
+};	
+
 static gboolean
 capture_req_props (FetchItemsCallbackData *item_data, gpointer data)
 {
@@ -1328,12 +1416,12 @@ capture_req_props (FetchItemsCallbackData *item_data, gpointer data)
 		cbdata->appt_seq = *ui32;
 	cbdata->cleanglobalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0023));
 	cbdata->globalid = (const struct Binary_r *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_BINARY, 0x0003));
-	cbdata->username = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
+	cbdata->username = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME_UNICODE);
 	cbdata->useridtype = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
-	cbdata->userid = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
-	cbdata->ownername = exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
+	cbdata->userid = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE);
+	cbdata->ownername = exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME_UNICODE);
 	cbdata->owneridtype = exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
-	cbdata->ownerid = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
+	cbdata->ownerid = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS_UNICODE);
 
 	return TRUE;
 }
@@ -1353,7 +1441,7 @@ get_server_data (ECalBackendMAPI *cbmapi, icalcomponent *comp, struct cbdata *cb
 	uid = icalcomponent_get_uid (comp);
 	exchange_mapi_util_mapi_id_from_string (uid, &mid);
 	if (exchange_mapi_connection_fetch_item (priv->conn, priv->fid, mid,
-					NULL, 0,
+					req_props_list, G_N_ELEMENTS (req_props_list),
 					NULL, NULL,
 					capture_req_props, cbdata,
 					MAPI_OPTIONS_FETCH_GENERIC_STREAMS))
@@ -1373,7 +1461,7 @@ get_server_data (ECalBackendMAPI *cbmapi, icalcomponent *comp, struct cbdata *cb
 	cast_mapi_SPropValue (&(res.res.resProperty.lpProp), &sprop);
 
 	exchange_mapi_connection_fetch_items (priv->conn, priv->fid, &res, NULL,
-					NULL, 0,
+					req_props_list, G_N_ELEMENTS (req_props_list),
 					NULL, NULL,
 					capture_req_props, cbdata,
 					MAPI_OPTIONS_FETCH_GENERIC_STREAMS);
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 9cc64f6..efb8bd5 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -550,14 +550,12 @@ mapi_update_cache (CamelFolder *folder, GSList *list, CamelFolderChangeInfo **ch
 				/* Build a SRow structure */
 				aRow = &recip->out_SRow;
 
-				type = (uint32_t *) find_SPropValue_data (aRow, PR_RECIPIENT_TYPE);
+				type = (uint32_t *) exchange_mapi_util_find_row_propval (aRow, PR_RECIPIENT_TYPE);
 
 				if (type) {
-					name = (const gchar *) find_SPropValue_data (aRow, PR_DISPLAY_NAME);
-					name = name ? name : (const gchar *) find_SPropValue_data (aRow, PR_RECIPIENT_DISPLAY_NAME);
-					name = name ? name : (const gchar *) find_SPropValue_data (aRow,
-												 PR_RECIPIENT_DISPLAY_NAME_UNICODE);
-					name = name ? name : (const gchar *) find_SPropValue_data (aRow,
+					name = (const gchar *) exchange_mapi_util_find_row_propval (aRow, PR_DISPLAY_NAME_UNICODE);
+					name = name ? name : (const gchar *) exchange_mapi_util_find_row_propval (aRow, PR_RECIPIENT_DISPLAY_NAME_UNICODE);
+					name = name ? name : (const gchar *) exchange_mapi_util_find_row_propval (aRow,
 												 PR_7BIT_DISPLAY_NAME_UNICODE);
 					display_name = name ? name : recip->email_id;
 					formatted_id = camel_internet_address_format_address(display_name, recip->email_id);
@@ -976,28 +974,20 @@ camel_mapi_folder_fetch_summary (CamelStore *store, const mapi_id_t fid, struct
 
 	const guint32 summary_prop_list[] = {
 		PR_INTERNET_CPID,
-		PR_SUBJECT,
 		PR_SUBJECT_UNICODE,
 		PR_MESSAGE_SIZE,
 		PR_MESSAGE_DELIVERY_TIME,
 		PR_MESSAGE_FLAGS,
-		PR_SENT_REPRESENTING_NAME,
 		PR_SENT_REPRESENTING_NAME_UNICODE,
-		PR_SENT_REPRESENTING_EMAIL_ADDRESS,
 		PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
 		PR_SENT_REPRESENTING_ADDRTYPE,
-		PR_SENT_REPRESENTING_ADDRTYPE_UNICODE,
 		PR_LAST_MODIFICATION_TIME,
 		PR_INTERNET_MESSAGE_ID,
 		PR_INTERNET_REFERENCES,
 		PR_IN_REPLY_TO_ID,
-		PR_DISPLAY_TO,
 		PR_DISPLAY_TO_UNICODE,
-		PR_DISPLAY_CC,
 		PR_DISPLAY_CC_UNICODE,
-		PR_DISPLAY_BCC,
 		PR_DISPLAY_BCC_UNICODE,
-		PR_TRANSPORT_MESSAGE_HEADERS,
 		PR_TRANSPORT_MESSAGE_HEADERS_UNICODE
 	};
 
@@ -1160,18 +1150,14 @@ static const uint32_t camel_GetPropsList[] = {
 	PR_MID,
 	PR_INTERNET_CPID,
 
-	PR_TRANSPORT_MESSAGE_HEADERS,
 	PR_TRANSPORT_MESSAGE_HEADERS_UNICODE,
 	PR_MESSAGE_CLASS,
-	PR_MESSAGE_CLASS_UNICODE,
 	PR_MESSAGE_SIZE,
 	PR_MESSAGE_FLAGS,
 	PR_MESSAGE_DELIVERY_TIME,
 	PR_MSG_EDITOR_FORMAT,
 
-	PR_SUBJECT,
 	PR_SUBJECT_UNICODE,
-	PR_CONVERSATION_TOPIC,
 	PR_CONVERSATION_TOPIC_UNICODE,
 
 	/*Properties used for message threading.*/
@@ -1186,11 +1172,8 @@ static const uint32_t camel_GetPropsList[] = {
 	/*PR_BODY_HTML, */
 	/*PR_BODY_HTML_UNICODE, */
 
-	PR_DISPLAY_TO,
 	PR_DISPLAY_TO_UNICODE,
-	PR_DISPLAY_CC,
 	PR_DISPLAY_CC_UNICODE,
-	PR_DISPLAY_BCC,
 	PR_DISPLAY_BCC_UNICODE,
 
 	PR_CREATION_TIME,
@@ -1203,25 +1186,16 @@ static const uint32_t camel_GetPropsList[] = {
 	PR_OWNER_APPT_ID,
 	PR_PROCESSED,
 
-	PR_SENT_REPRESENTING_NAME,
 	PR_SENT_REPRESENTING_NAME_UNICODE,
 	PR_SENT_REPRESENTING_ADDRTYPE,
-	PR_SENT_REPRESENTING_ADDRTYPE_UNICODE,
-	PR_SENT_REPRESENTING_EMAIL_ADDRESS,
 	PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
 
-	PR_SENDER_NAME,
 	PR_SENDER_NAME_UNICODE,
 	PR_SENDER_ADDRTYPE,
-	PR_SENDER_ADDRTYPE_UNICODE,
-	PR_SENDER_EMAIL_ADDRESS,
 	PR_SENDER_EMAIL_ADDRESS_UNICODE,
 
-	PR_RCVD_REPRESENTING_NAME,
 	PR_RCVD_REPRESENTING_NAME_UNICODE,
 	PR_RCVD_REPRESENTING_ADDRTYPE,
-	PR_RCVD_REPRESENTING_ADDRTYPE_UNICODE,
-	PR_RCVD_REPRESENTING_EMAIL_ADDRESS,
 	PR_RCVD_REPRESENTING_EMAIL_ADDRESS_UNICODE
 };
 
@@ -1358,7 +1332,7 @@ fetch_item_cb (FetchItemsCallbackData *item_data, gpointer data)
 
 		if (appointment_body_str && *appointment_body_str) {
 			body = g_new0(ExchangeMAPIStream, 1);
-			body->proptag = PR_BODY;
+			body->proptag = PR_BODY_UNICODE;
 			body->value = g_byte_array_new ();
 			body->value = g_byte_array_append (body->value, appointment_body_str, strlen ((const gchar *)appointment_body_str));
 
@@ -1429,12 +1403,11 @@ mapi_mime_set_recipient_list (CamelMimeMessage *msg, MapiItem *item)
 		aRow = &recip->out_SRow;
 
 		/*Name is probably available in one of these props.*/
-		name = (const gchar *) find_SPropValue_data (aRow, PR_DISPLAY_NAME);
-		name = name ? name : (const gchar *) find_SPropValue_data (aRow, PR_RECIPIENT_DISPLAY_NAME);
-		name = name ? name : (const gchar *) find_SPropValue_data (aRow, PR_RECIPIENT_DISPLAY_NAME_UNICODE);
-		name = name ? name : (const gchar *) find_SPropValue_data (aRow, PR_7BIT_DISPLAY_NAME_UNICODE);
+		name = (const gchar *) exchange_mapi_util_find_row_propval (aRow, PR_DISPLAY_NAME_UNICODE);
+		name = name ? name : (const gchar *) exchange_mapi_util_find_row_propval (aRow, PR_RECIPIENT_DISPLAY_NAME_UNICODE);
+		name = name ? name : (const gchar *) exchange_mapi_util_find_row_propval (aRow, PR_7BIT_DISPLAY_NAME_UNICODE);
 
-		type = (uint32_t *) find_SPropValue_data (aRow, PR_RECIPIENT_TYPE);
+		type = (uint32_t *) exchange_mapi_util_find_row_propval (aRow, PR_RECIPIENT_TYPE);
 
 		/*Fallbacks. Not good*/
 		display_name = name ? g_strdup (name) : g_strdup (recip->email_id);
@@ -1732,11 +1705,11 @@ mapi_mime_classify_attachments (GSList *attachments, GSList **inline_attachs, GS
 		part = camel_mime_part_new ();
 
 		filename = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach->lpProps,
-											 PR_ATTACH_LONG_FILENAME);
+											 PR_ATTACH_LONG_FILENAME_UNICODE);
 
 		if (!(filename && *filename))
 			filename = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach->lpProps,
-												 PR_ATTACH_FILENAME);
+												 PR_ATTACH_FILENAME_UNICODE);
 		camel_mime_part_set_filename(part, g_strdup(filename));
 		camel_content_type_set_param (((CamelDataWrapper *) part)->mime_type, "name", filename);
 
diff --git a/src/camel/camel-mapi-utils.c b/src/camel/camel-mapi-utils.c
index a74f544..f4e47ef 100644
--- a/src/camel/camel-mapi-utils.c
+++ b/src/camel/camel-mapi-utils.c
@@ -79,11 +79,11 @@ mapi_item_add_recipient (const gchar *recipients, OlMailRecipientType type, GSLi
 	str = "SMTP";
 	set_SPropValue_proptag (&(recipient->in.ext_lpProps[2]), PR_ADDRTYPE, (gconstpointer )(str));
 	str = recipient->email_id;
-	set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS, (gconstpointer )(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS_UNICODE, (gconstpointer )(str));
 	/* FIXME: Please add the correct names here instead of the e-mail ID */
-	set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME, (gconstpointer )(str));
-	set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME, (gconstpointer )(str));
-	set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME, (gconstpointer )(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME_UNICODE, (gconstpointer )(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
 
 	bVal = FALSE;
 	set_SPropValue_proptag (&(recipient->in.ext_lpProps[7]), PR_SEND_RICH_INFO, &bVal);
@@ -203,11 +203,11 @@ mapi_item_add_attach (MapiItem *item, CamelMimePart *part, CamelStream *content_
 
 	if (filename) {
 		set_SPropValue_proptag(&(item_attach->lpProps[i++]),
-				       PR_ATTACH_FILENAME,
+				       PR_ATTACH_FILENAME_UNICODE,
 				       (gconstpointer ) g_strdup(filename));
 
 		set_SPropValue_proptag(&(item_attach->lpProps[i++]),
-				       PR_ATTACH_LONG_FILENAME,
+				       PR_ATTACH_LONG_FILENAME_UNICODE,
 				       (gconstpointer ) g_strdup(filename));
 	}
 
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index e0e8e76..851f7b4 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -248,8 +248,8 @@ exchange_mapi_cal_util_fetch_attachments (ECalComponent *comp, GSList **attach_l
 			flag = 0xFFFFFFFF;
 			set_SPropValue_proptag(&(attach_item->lpProps[1]), PR_RENDERING_POSITION, (gconstpointer ) (&flag));
 
-			set_SPropValue_proptag(&(attach_item->lpProps[2]), PR_ATTACH_FILENAME, (gconstpointer ) g_strdup(split_name));
-			set_SPropValue_proptag(&(attach_item->lpProps[3]), PR_ATTACH_LONG_FILENAME, (gconstpointer ) g_strdup(split_name));
+			set_SPropValue_proptag(&(attach_item->lpProps[2]), PR_ATTACH_FILENAME_UNICODE, (gconstpointer ) g_strdup(split_name));
+			set_SPropValue_proptag(&(attach_item->lpProps[3]), PR_ATTACH_LONG_FILENAME_UNICODE, (gconstpointer ) g_strdup(split_name));
 
 			stream = g_new0 (ExchangeMAPIStream, 1);
 			stream->proptag = PR_ATTACH_DATA_BIN;
@@ -324,7 +324,7 @@ exchange_mapi_cal_util_fetch_organizer (ECalComponent *comp, GSList **recip_list
 		str = icalparameter_get_cn (param);
 		if (!(str && *str))
 			str = "";
-		set_SPropValue_proptag (&(recipient->in.req_lpProps[4]), PR_RECIPIENT_DISPLAY_NAME, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.req_lpProps[4]), PR_RECIPIENT_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
 
 		/* External recipient properties - set them only when the recipient is unresolved */
 		recipient->in.ext_cValues = 5;
@@ -337,13 +337,13 @@ exchange_mapi_cal_util_fetch_organizer (ECalComponent *comp, GSList **recip_list
 		str = "SMTP";
 		set_SPropValue_proptag (&(recipient->in.ext_lpProps[2]), PR_ADDRTYPE, (gconstpointer )(str));
 		str = recipient->email_id;
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS_UNICODE, (gconstpointer )(str));
 
 		param = icalproperty_get_first_parameter (org_prop, ICAL_CN_PARAMETER);
 		str = icalparameter_get_cn (param);
 		if (!(str && *str))
 			str = "";
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_DISPLAY_NAME, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
 
 		*recip_list = g_slist_append (*recip_list, recipient);
 	}
@@ -397,7 +397,7 @@ exchange_mapi_cal_util_fetch_recipients (ECalComponent *comp, GSList **recip_lis
 		param = icalproperty_get_first_parameter (att_prop, ICAL_CN_PARAMETER);
 		str = icalparameter_get_cn (param);
 		str = (str) ? str : recipient->email_id;
-		set_SPropValue_proptag (&(recipient->in.req_lpProps[4]), PR_RECIPIENT_DISPLAY_NAME, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.req_lpProps[4]), PR_RECIPIENT_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
 
 		/* External recipient properties - set them only when the recipient is unresolved */
 		recipient->in.ext_cValues = 7;
@@ -410,14 +410,14 @@ exchange_mapi_cal_util_fetch_recipients (ECalComponent *comp, GSList **recip_lis
 		str = "SMTP";
 		set_SPropValue_proptag (&(recipient->in.ext_lpProps[2]), PR_ADDRTYPE, (gconstpointer )(str));
 		str = recipient->email_id;
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS_UNICODE, (gconstpointer )(str));
 
 		param = icalproperty_get_first_parameter (att_prop, ICAL_CN_PARAMETER);
 		str = icalparameter_get_cn (param);
 		str = (str) ? str : recipient->email_id;
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME, (gconstpointer )(str));
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME, (gconstpointer )(str));
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME_UNICODE, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME_UNICODE, (gconstpointer )(str));
 
 		*recip_list = g_slist_append (*recip_list, recipient);
 
@@ -449,9 +449,9 @@ set_attachments_to_cal_component (ECalComponent *comp, GSList *attach_list, cons
 		attach = (const gchar *)stream->value->data;
 		len = stream->value->len;
 
-		str = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach_item->lpProps, PR_ATTACH_LONG_FILENAME);
+		str = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach_item->lpProps, PR_ATTACH_LONG_FILENAME_UNICODE);
 		if (!(str && *str))
-			str = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach_item->lpProps, PR_ATTACH_FILENAME);
+			str = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval(attach_item->lpProps, PR_ATTACH_FILENAME_UNICODE);
 		attach_file_url = g_strconcat (local_store_uri, G_DIR_SEPARATOR_S, uid, "-", str, NULL);
 		filename = g_filename_from_uri (attach_file_url, NULL, NULL);
 
@@ -499,9 +499,9 @@ ical_attendees_from_props (icalcomponent *ical_comp, GSList *recipients, gboolea
 			prop = icalproperty_new_organizer (val);
 
 			/* CN */
-			str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_RECIPIENT_DISPLAY_NAME);
+			str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_RECIPIENT_DISPLAY_NAME_UNICODE);
 			if (!str)
-				str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_DISPLAY_NAME);
+				str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_DISPLAY_NAME_UNICODE);
 			if (str) {
 				param = icalparameter_new_cn (str);
 				icalproperty_add_parameter (prop, param);
@@ -510,9 +510,9 @@ ical_attendees_from_props (icalcomponent *ical_comp, GSList *recipients, gboolea
 			prop = icalproperty_new_attendee (val);
 
 			/* CN */
-			str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_RECIPIENT_DISPLAY_NAME);
+			str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_RECIPIENT_DISPLAY_NAME_UNICODE);
 			if (!str)
-				str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_DISPLAY_NAME);
+				str = (const gchar *) exchange_mapi_util_find_row_propval (&recip->out_SRow, PR_DISPLAY_NAME_UNICODE);
 			if (str) {
 				param = icalparameter_new_cn (str);
 				icalproperty_add_parameter (prop, param);
@@ -700,15 +700,15 @@ exchange_mapi_cal_util_mapi_props_to_comp (ExchangeMapiConnection *conn, icalcom
 
 	utc_zone = icaltimezone_get_utc_timezone ();
 
-	subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_SUBJECT);
+	subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_SUBJECT_UNICODE);
 	if (!subject)
-		subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_NORMALIZED_SUBJECT);
+		subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_NORMALIZED_SUBJECT_UNICODE);
 	if (!subject)
-		subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_CONVERSATION_TOPIC);
+		subject = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_CONVERSATION_TOPIC_UNICODE);
 	if (!subject)
 		subject = "";
 
-	body = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_BODY);
+	body = (const gchar *)exchange_mapi_util_find_array_propval(properties, PR_BODY_UNICODE);
 	if (!body) {
 		body_stream = exchange_mapi_util_find_stream (streams, PR_HTML);
 		body = body_stream ? (const gchar *) body_stream->value->data : "";
@@ -815,12 +815,12 @@ exchange_mapi_cal_util_mapi_props_to_comp (ExchangeMapiConnection *conn, icalcom
 			ical_attendees_from_props (ical_comp, recipients, (b && *b));
 			if (icalcomponent_get_first_property (ical_comp, ICAL_ORGANIZER_PROPERTY) == NULL) {
 				gchar *val;
-//				const gchar *sender_name = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
+//				const gchar *sender_name = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME_UNICODE);
 				const gchar *sender_email_type = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
-				const gchar *sender_email = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
-				const gchar *sent_name = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
+				const gchar *sender_email = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS_UNICODE);
+				const gchar *sent_name = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME_UNICODE);
 				const gchar *sent_email_type = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
-				const gchar *sent_email = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
+				const gchar *sent_email = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE);
 
 				if (!g_utf8_collate (sender_email_type, "EX"))
 					sender_email = exchange_mapi_connection_ex_to_smtp (conn, sender_email);
@@ -1027,12 +1027,12 @@ fetch_server_data_cb (FetchItemsCallbackData *item_data, gpointer data)
 	cbdata->appt_id = ui32 ? *ui32 : 0;
 	ui32 = (const uint32_t *)find_mapi_SPropValue_data(properties, PROP_TAG(PT_LONG, 0x8201));
 	cbdata->appt_seq = ui32 ? *ui32 : 0;
-	cbdata->username = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
+	cbdata->username = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME_UNICODE);
 	cbdata->useridtype = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
-	cbdata->userid = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
-	cbdata->ownername = exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
+	cbdata->userid = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE);
+	cbdata->ownername = exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME_UNICODE);
 	cbdata->owneridtype = exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
-	cbdata->ownerid = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
+	cbdata->ownerid = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS_UNICODE);
 
 	cbdata->comp = comp;
 
@@ -1086,12 +1086,12 @@ update_attendee_status (ExchangeMapiConnection *conn, struct mapi_SPropValue_arr
 
 	fetch_server_data (conn, mid, &cbdata);
 
-	att = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
+	att = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE);
 	addrtype = exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
 	if (addrtype && !g_ascii_strcasecmp (addrtype, "EX"))
 		att = exchange_mapi_connection_ex_to_smtp (conn, att);
 
-	att_sentby = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
+	att_sentby = exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS_UNICODE);
 	addrtype = exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
 	if (addrtype && !g_ascii_strcasecmp (addrtype, "EX"))
 		att_sentby = exchange_mapi_connection_ex_to_smtp (conn, att_sentby);
@@ -1197,12 +1197,12 @@ update_server_object (ExchangeMapiConnection *conn, struct mapi_SPropValue_array
 		icalcomponent_kind kind = icalcomponent_isa (e_cal_component_get_icalcomponent(comp));
 
 		cbdata.comp = comp;
-		cbdata.username = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME);
+		cbdata.username = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_NAME_UNICODE);
 		cbdata.useridtype = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_ADDRTYPE);
-		cbdata.userid = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS);
-		cbdata.ownername = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME);
+		cbdata.userid = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENDER_EMAIL_ADDRESS_UNICODE);
+		cbdata.ownername = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_NAME_UNICODE);
 		cbdata.owneridtype = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_ADDRTYPE);
-		cbdata.ownerid = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS);
+		cbdata.ownerid = (const gchar *) exchange_mapi_util_find_array_propval (properties, PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE);
 		cbdata.is_modify = FALSE;
 		cbdata.msgflags = MSGFLAG_READ;
 		cbdata.meeting_type = MEETING_REQUEST_RCVD;
@@ -1663,12 +1663,12 @@ exchange_mapi_cal_util_build_props (struct SPropValue **value, struct SPropTagAr
 	text = icalcomponent_get_summary (ical_comp);
 	if (!(text && *text))
 		text = "";
-	set_SPropValue_proptag(&props[i++], PR_SUBJECT,						/* propcount++ */
+	set_SPropValue_proptag(&props[i++], PR_SUBJECT_UNICODE,						/* propcount++ */
 					(gconstpointer ) text);
-	set_SPropValue_proptag(&props[i++], PR_NORMALIZED_SUBJECT,				/* propcount++ */
+	set_SPropValue_proptag(&props[i++], PR_NORMALIZED_SUBJECT_UNICODE,				/* propcount++ */
 					(gconstpointer ) text);
 	if (cbdata->appt_seq == 0)
-		set_SPropValue_proptag(&props[i++], PR_CONVERSATION_TOPIC,			/* propcount++ */
+		set_SPropValue_proptag(&props[i++], PR_CONVERSATION_TOPIC_UNICODE,			/* propcount++ */
 						(gconstpointer ) text);
 	text = NULL;
 
@@ -1680,7 +1680,7 @@ exchange_mapi_cal_util_build_props (struct SPropValue **value, struct SPropTagAr
 	text = icalcomponent_get_description (ical_comp);
 	if (!(text && *text) || !g_utf8_validate (text, -1, NULL))
 		text = "";
-	set_SPropValue_proptag(&props[i++], PR_BODY,						/* propcount++ */
+	set_SPropValue_proptag(&props[i++], PR_BODY_UNICODE,						/* propcount++ */
 					(gconstpointer ) text);
 	text = NULL;
 
@@ -1691,17 +1691,17 @@ exchange_mapi_cal_util_build_props (struct SPropValue **value, struct SPropTagAr
 	flag32 = prop ? get_imp_prop_from_priority (icalproperty_get_priority (prop)) : IMPORTANCE_NORMAL;
 	set_SPropValue_proptag(&props[i++], PR_IMPORTANCE, (gconstpointer ) &flag32);		/* propcount++ */
 
-	set_SPropValue_proptag(&props[i++], PR_SENT_REPRESENTING_NAME,
+	set_SPropValue_proptag(&props[i++], PR_SENT_REPRESENTING_NAME_UNICODE,
 		(gconstpointer ) cbdata->ownername);						/* propcount++ */
 	set_SPropValue_proptag(&props[i++], PR_SENT_REPRESENTING_ADDRTYPE,
 		(gconstpointer ) cbdata->owneridtype);						/* propcount++ */
-	set_SPropValue_proptag(&props[i++], PR_SENT_REPRESENTING_EMAIL_ADDRESS,
+	set_SPropValue_proptag(&props[i++], PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
 		(gconstpointer ) cbdata->ownerid);						/* propcount++ */
-	set_SPropValue_proptag(&props[i++], PR_SENDER_NAME,
+	set_SPropValue_proptag(&props[i++], PR_SENDER_NAME_UNICODE,
 		(gconstpointer ) cbdata->username);						/* propcount++ */
 	set_SPropValue_proptag(&props[i++], PR_SENDER_ADDRTYPE,
 		(gconstpointer ) cbdata->useridtype);						/* propcount++ */
-	set_SPropValue_proptag(&props[i++], PR_SENDER_EMAIL_ADDRESS,
+	set_SPropValue_proptag(&props[i++], PR_SENDER_EMAIL_ADDRESS_UNICODE,
 		(gconstpointer ) cbdata->userid);						/* propcount++ */
 
 	flag32 = cbdata->msgflags;
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.h b/src/libexchangemapi/exchange-mapi-cal-utils.h
index 06148c3..50fb853 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.h
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.h
@@ -105,11 +105,8 @@ static const uint32_t cal_GetPropsList[] = {
 	PR_FID,
 	PR_MID,
 
-	PR_SUBJECT,
 	PR_SUBJECT_UNICODE,
-	PR_NORMALIZED_SUBJECT,
 	PR_NORMALIZED_SUBJECT_UNICODE,
-	PR_CONVERSATION_TOPIC,
 	PR_CONVERSATION_TOPIC_UNICODE,
 	PR_BODY,
 	PR_BODY_UNICODE,
@@ -125,25 +122,16 @@ static const uint32_t cal_GetPropsList[] = {
 	PR_PROCESSED,
 	PR_MSG_EDITOR_FORMAT,
 
-	PR_SENT_REPRESENTING_NAME,
 	PR_SENT_REPRESENTING_NAME_UNICODE,
 	PR_SENT_REPRESENTING_ADDRTYPE,
-	PR_SENT_REPRESENTING_ADDRTYPE_UNICODE,
-	PR_SENT_REPRESENTING_EMAIL_ADDRESS,
 	PR_SENT_REPRESENTING_EMAIL_ADDRESS_UNICODE,
 
-	PR_SENDER_NAME,
 	PR_SENDER_NAME_UNICODE,
 	PR_SENDER_ADDRTYPE,
-	PR_SENDER_ADDRTYPE_UNICODE,
-	PR_SENDER_EMAIL_ADDRESS,
 	PR_SENDER_EMAIL_ADDRESS_UNICODE,
 
-	PR_RCVD_REPRESENTING_NAME,
 	PR_RCVD_REPRESENTING_NAME_UNICODE,
 	PR_RCVD_REPRESENTING_ADDRTYPE,
-	PR_RCVD_REPRESENTING_ADDRTYPE_UNICODE,
-	PR_RCVD_REPRESENTING_EMAIL_ADDRESS,
 	PR_RCVD_REPRESENTING_EMAIL_ADDRESS_UNICODE
 };
 
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index b9ae4e8..b02e79f 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -493,7 +493,7 @@ exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream
 		if (editor != olEditorText && editor != olEditorHTML)
 			editor = olEditorHTML;
 	} else {
-		const uint32_t *ui32 = (const uint32_t *) get_SPropValue(lpProps, PR_MSG_EDITOR_FORMAT);
+		const uint32_t *ui32 = (const uint32_t *) exchange_mapi_util_find_SPropVal_array_propval(lpProps, PR_MSG_EDITOR_FORMAT);
 		/* if PR_MSG_EDITOR_FORMAT doesn't exist, set it to PLAINTEXT */
 		editor = ui32 ? *ui32 : olEditorText;
 	}
@@ -505,9 +505,9 @@ exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream
 	retval = -1;
 	switch (editor) {
 		case olEditorText:
-			if ((data = (const gchar *) get_SPropValue (lpProps, PR_BODY_UNICODE)) != NULL)
+			if ((data = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (lpProps, PR_BODY_UNICODE)) != NULL)
 				proptag = PR_BODY_UNICODE;
-			else if ((data = (const gchar *) get_SPropValue (lpProps, PR_BODY)) != NULL)
+			else if ((data = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (lpProps, PR_BODY)) != NULL)
 				proptag = PR_BODY;
 			if (data) {
 				gsize size = strlen(data)+1;
@@ -518,9 +518,9 @@ exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream
 			break;
 		case olEditorHTML:
 			/* Fixme : */
-			/*if ((data = (const gchar *) get_SPropValue (lpProps, PR_BODY_HTML_UNICODE)) != NULL) */
+			/*if ((data = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (lpProps, PR_BODY_HTML_UNICODE)) != NULL) */
 			/*	proptag = PR_BODY_HTML_UNICODE; */
-			if ((data = (const gchar *) get_SPropValue (lpProps, PR_BODY_HTML)) != NULL)
+			if ((data = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (lpProps, PR_BODY_HTML)) != NULL)
 				proptag = PR_BODY_HTML;
 
 			if (data) {
@@ -533,7 +533,7 @@ exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream
 			}
 			break;
 		case olEditorRTF:
-			rtf_in_sync = (const bool *) get_SPropValue (lpProps, PR_RTF_IN_SYNC);
+			rtf_in_sync = (const bool *) exchange_mapi_util_find_SPropVal_array_propval (lpProps, PR_RTF_IN_SYNC);
 //			if (!(rtf_in_sync && *rtf_in_sync))
 			{
 				mapi_object_t obj_stream;
@@ -909,10 +909,10 @@ mapidump_PAB_gal_entry (struct SRow *aRow)
 	const gchar	*account;
 	ExchangeMAPIGALEntry *gal_entry;
 
-	addrtype = (const gchar *)find_SPropValue_data(aRow, PR_ADDRTYPE_UNICODE);
-	name = (const gchar *)find_SPropValue_data(aRow, PR_DISPLAY_NAME_UNICODE);
-	email = (const gchar *)find_SPropValue_data(aRow, PR_SMTP_ADDRESS_UNICODE);
-	account = (const gchar *)find_SPropValue_data(aRow, PR_ACCOUNT_UNICODE);
+	addrtype = (const gchar *)exchange_mapi_util_find_row_propval (aRow, PR_ADDRTYPE);
+	name = (const gchar *)exchange_mapi_util_find_row_propval (aRow, PR_DISPLAY_NAME_UNICODE);
+	email = (const gchar *)exchange_mapi_util_find_row_propval (aRow, PR_SMTP_ADDRESS_UNICODE);
+	account = (const gchar *)exchange_mapi_util_find_row_propval (aRow, PR_ACCOUNT_UNICODE);
 
 	printf("[%s] %s:\n\tName: %-25s\n\tEmail: %-25s\n",
 	       addrtype, account, name, email);
@@ -948,7 +948,7 @@ exchange_mapi_connection_get_gal (ExchangeMapiConnection *conn, GPtrArray *conta
 					  PR_SMTP_ADDRESS_UNICODE,
 					  PR_DISPLAY_TYPE,
 					  PR_OBJECT_TYPE,
-					  PR_ADDRTYPE_UNICODE,
+					  PR_ADDRTYPE,
 					  PR_OFFICE_TELEPHONE_NUMBER_UNICODE,
 					  PR_OFFICE_LOCATION_UNICODE,
 					  PR_TITLE_UNICODE,
@@ -1010,12 +1010,12 @@ exchange_mapi_util_get_recipients (mapi_object_t *obj_message, GSList **recip_li
 
 		recipient->mem_ctx = talloc_init ("ExchangeMAPI_GetRecipients");
 
-		recipient->email_id = talloc_steal (recipient->mem_ctx, (const gchar *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_SMTP_ADDRESS));
+		recipient->email_id = talloc_steal (recipient->mem_ctx, (const gchar *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_SMTP_ADDRESS_UNICODE));
 		/* fallback */
 		if (!recipient->email_id) {
 			const gchar *addrtype = talloc_steal (recipient->mem_ctx, (const gchar *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_ADDRTYPE));
 			if (addrtype && !g_ascii_strcasecmp(addrtype, "SMTP"))
-				recipient->email_id = talloc_steal (recipient->mem_ctx, (const gchar *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_EMAIL_ADDRESS));
+				recipient->email_id = talloc_steal (recipient->mem_ctx, (const gchar *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_EMAIL_ADDRESS_UNICODE));
 		}
 		/* fail */
 		if (!recipient->email_id) {
@@ -1052,9 +1052,9 @@ set_recipient_properties (TALLOC_CTX *mem_ctx, struct SRow *aRow, ExchangeMAPIRe
 		struct SPropValue sprop;
 		const gchar *dn = NULL, *email = NULL;
 
-		dn = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_DISPLAY_NAME);
+		dn = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (recipient->in.ext_lpProps, PR_DISPLAY_NAME_UNICODE);
 		dn = (dn) ? dn : "";
-		email = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_SMTP_ADDRESS);
+		email = (const gchar *) exchange_mapi_util_find_SPropVal_array_propval (recipient->in.ext_lpProps, PR_SMTP_ADDRESS_UNICODE);
 		email = (email) ? email : "";
 		oneoff_eid = exchange_mapi_util_entryid_generate_oneoff (mem_ctx, dn, email, FALSE);
 		set_SPropValue_proptag (&sprop, PR_ENTRYID, (gconstpointer )(oneoff_eid));
@@ -1095,7 +1095,7 @@ exchange_mapi_util_modify_recipients (ExchangeMapiConnection *conn, TALLOC_CTX *
 					  PR_DISPLAY_TYPE,
 					  PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE,
 					  PR_EMAIL_ADDRESS_UNICODE,
-					  PR_ADDRTYPE_UNICODE,
+					  PR_ADDRTYPE,
 					  PR_SEND_RICH_INFO,
 					  PR_7BIT_DISPLAY_NAME_UNICODE,
 					  PR_SMTP_ADDRESS_UNICODE);
@@ -1213,7 +1213,7 @@ exchange_mapi_connection_check_restriction (ExchangeMapiConnection *conn, mapi_i
 					  PR_MID,
 					  PR_INST_ID,
 					  PR_INSTANCE_NUM,
-					  PR_SUBJECT,
+					  PR_SUBJECT_UNICODE,
 					  PR_MESSAGE_CLASS,
 					  PR_LAST_MODIFICATION_TIME,
 					  PR_HASATTACH,
@@ -1928,7 +1928,7 @@ exchange_mapi_connection_rename_folder (ExchangeMapiConnection *conn, mapi_id_t
 	}
 
 	props = talloc_zero(mem_ctx, struct SPropValue);
-	set_SPropValue_proptag (props, PR_DISPLAY_NAME, new_name);
+	set_SPropValue_proptag (props, PR_DISPLAY_NAME_UNICODE, new_name);
 
 	retval = SetProps(&obj_folder, props, 1);
 	if (retval != MAPI_E_SUCCESS) {
@@ -2789,13 +2789,13 @@ get_child_folders(TALLOC_CTX *mem_ctx, ExchangeMAPIFolderCategory folder_hier, m
 		ExchangeMAPIFolder *folder = NULL;
 		gchar *newname = NULL;
 
-		const mapi_id_t *fid = (const mapi_id_t *)find_SPropValue_data(&rowset.aRow[i], PR_FID);
-		const gchar *class = (const gchar *)find_SPropValue_data(&rowset.aRow[i], PR_CONTAINER_CLASS);
-		const gchar *name = (const gchar *)find_SPropValue_data(&rowset.aRow[i], PR_DISPLAY_NAME_UNICODE);
-		const uint32_t *unread = (const uint32_t *)find_SPropValue_data(&rowset.aRow[i], PR_CONTENT_UNREAD);
-		const uint32_t *total = (const uint32_t *)find_SPropValue_data(&rowset.aRow[i], PR_CONTENT_COUNT);
-		const uint32_t *child = (const uint32_t *)find_SPropValue_data(&rowset.aRow[i], PR_FOLDER_CHILD_COUNT);
-		const uint32_t *folder_size = (const uint32_t *)find_SPropValue_data(&rowset.aRow[i], PR_MESSAGE_SIZE);
+		const mapi_id_t *fid = (const mapi_id_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_FID);
+		const gchar *class = (const gchar *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_CONTAINER_CLASS);
+		const gchar *name = (const gchar *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_DISPLAY_NAME_UNICODE);
+		const uint32_t *unread = (const uint32_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_CONTENT_UNREAD);
+		const uint32_t *total = (const uint32_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_CONTENT_COUNT);
+		const uint32_t *child = (const uint32_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_FOLDER_CHILD_COUNT);
+		const uint32_t *folder_size = (const uint32_t *)exchange_mapi_util_find_row_propval (&rowset.aRow[i], PR_MESSAGE_SIZE);
 
 		if (!class)
 			class = IPF_NOTE;
@@ -2886,7 +2886,7 @@ mapi_get_ren_additional_fids (mapi_object_t *obj_store, GHashTable **folder_list
 	aRow.cValues = count;
 	aRow.lpProps = lpProps;
 
-	entryids = (const struct BinaryArray_r *) find_SPropValue_data(&aRow, PR_ADDITIONAL_REN_ENTRYIDS);
+	entryids = (const struct BinaryArray_r *) exchange_mapi_util_find_row_propval (&aRow, PR_ADDITIONAL_REN_ENTRYIDS);
 
 	/* Iterate through MV_BINARY */
 	if (entryids) {
@@ -3008,10 +3008,10 @@ exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList
 	aRow.lpProps = lpProps;
 
 	/* betting that these will never fail */
-	mailbox_name = (const gchar *) find_SPropValue_data(&aRow, PR_DISPLAY_NAME_UNICODE);
-	mailbox_owner_name = (const gchar *) find_SPropValue_data(&aRow, PR_MAILBOX_OWNER_NAME_UNICODE);
-	mailbox_user_name = (const gchar *) find_SPropValue_data(&aRow, PR_USER_NAME_UNICODE);
-	mailbox_size = (const uint32_t *)find_SPropValue_data (&aRow, PR_MESSAGE_SIZE);
+	mailbox_name = (const gchar *) exchange_mapi_util_find_row_propval (&aRow, PR_DISPLAY_NAME_UNICODE);
+	mailbox_owner_name = (const gchar *) exchange_mapi_util_find_row_propval (&aRow, PR_MAILBOX_OWNER_NAME_UNICODE);
+	mailbox_user_name = (const gchar *) exchange_mapi_util_find_row_propval (&aRow, PR_USER_NAME_UNICODE);
+	mailbox_size = (const uint32_t *)exchange_mapi_util_find_row_propval  (&aRow, PR_MESSAGE_SIZE);
 
 	/* Prepare the directory listing */
 	retval = GetDefaultFolder(&priv->msg_store, &mailbox_id, olFolderTopInformationStore);
@@ -3152,8 +3152,7 @@ exchange_mapi_connection_ex_to_smtp (ExchangeMapiConnection *conn, const gchar *
 
 	LOCK ();
 
-	SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
-					  PR_SMTP_ADDRESS,
+	SPropTagArray = set_SPropTagArray(mem_ctx, 0x1,
 					  PR_SMTP_ADDRESS_UNICODE);
 
 	retval = ResolveNames (priv->session, (const gchar **)str_array, SPropTagArray, &SRowSet, &flaglist, 0);
@@ -3161,9 +3160,7 @@ exchange_mapi_connection_ex_to_smtp (ExchangeMapiConnection *conn, const gchar *
 		retval = ResolveNames (priv->session, (const gchar **)str_array, SPropTagArray, &SRowSet, &flaglist, MAPI_UNICODE);
 
 	if (retval == MAPI_E_SUCCESS && SRowSet && SRowSet->cRows == 1) {
-		smtp_addr = (const gchar *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS);
-		if (!smtp_addr)
-			smtp_addr = (const gchar *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS_UNICODE);
+		smtp_addr = (const gchar *) exchange_mapi_util_find_row_propval (SRowSet->aRow, PR_SMTP_ADDRESS_UNICODE);
 	}
 
 	talloc_free (mem_ctx);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]