[evolution-ews/gnome-3-4] Bug #670217 - Doesn't show all calendar events



commit 3a784bd6091793b4e9848b716d065596a31f964b
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 2 12:53:35 2012 +0200

    Bug #670217 - Doesn't show all calendar events

 src/addressbook/e-book-backend-ews.c |   15 ++++-
 src/calendar/e-cal-backend-ews.c     |   21 +++++-
 src/camel/camel-ews-folder.c         |    2 +-
 src/camel/camel-ews-utils.c          |   10 +++
 src/server/e-ews-connection.c        |  130 +++++++++++++++++++++++++++-------
 src/server/e-ews-item.c              |   48 ++++++++++++-
 src/server/e-ews-item.h              |    7 ++-
 src/server/ews-errors.c              |    1 +
 src/server/ews-errors.h              |    1 +
 src/server/tests/test-syncfolder.c   |   11 +++-
 10 files changed, 210 insertions(+), 36 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 6926e3a..ab05e5e 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -1866,6 +1866,11 @@ ebews_store_contact_items (EBookBackendEws *ebews,
 		EEwsItem *item;
 
 		item = (EEwsItem *) l->data;
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			g_object_unref (item);
+			continue;
+		}
+
 		contact = e_contact_new ();
 
 		if (!distribution_list) {
@@ -1907,6 +1912,11 @@ ebews_get_vcards_list (GSList *new_items,
 		gchar *vcard_string = NULL;
 
 		item = (EEwsItem *) l->data;
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			g_object_unref (item);
+			continue;
+		}
+
 		contact = e_contact_new ();
 
 		for (i = 0; i < G_N_ELEMENTS (mappings); i++) {
@@ -2103,10 +2113,13 @@ ebews_fetch_items (EBookBackendEws *ebews,
 		EEwsItem *item = (EEwsItem *) l->data;
 		const gchar *d_name;
 		const EwsId *id;
-		EwsMailbox *mb = g_new0 (EwsMailbox, 1);
+		EwsMailbox *mb;
 		GSList *members = NULL;
 		gboolean includes_last;
 
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR)
+			continue;
+
 		id = e_ews_item_get_id (item);
 		mb = g_new0 (EwsMailbox, 1);
 		mb->item_id = (EwsId *) id;
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 981eef0..b78d732 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -1425,12 +1425,20 @@ ews_create_object_cb (GObject *object,
 			NULL, NULL, NULL, &error);
 		if (!res && error != NULL) {
 			if (items_req)
-				g_slist_free (items_req);
+				g_slist_free_full (items_req, g_object_unref);
 			e_data_cal_respond_create_object (create_data->cal, create_data->context, error, NULL, NULL);
 			return;
 		}
 
 		item = (EEwsItem *) items_req->data;
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			error = g_error_copy (e_ews_item_get_error (item));
+			g_slist_free_full (items_req, g_object_unref);
+
+			e_data_cal_respond_create_object (create_data->cal, create_data->context, error, NULL, NULL);
+			return;
+		}
+
 		item_id = e_ews_item_get_id (item);
 
 		g_slist_free (items);
@@ -3176,7 +3184,7 @@ ews_cal_get_items_ready_cb (GObject *obj,
 	priv = cbews->priv;
 	cnc = (EEwsConnection *) obj;
 
-	e_ews_connection_get_items_finish	(cnc, res, &items, &error);
+	e_ews_connection_get_items_finish (cnc, res, &items, &error);
 	if (error != NULL) {
 		g_warning ("Unable to get items %s \n", error->message);
 
@@ -3190,8 +3198,13 @@ ews_cal_get_items_ready_cb (GObject *obj,
 
 	/* fetch modified occurrences */
 	for (l = items; l != NULL; l = g_slist_next (l)) {
-		const GSList *modified_occurrences = e_ews_item_get_modified_occurrences (l->data);
+		EEwsItem *item = l->data;
+		const GSList *modified_occurrences;
+
+		if (!item || e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR)
+			continue;
 
+		modified_occurrences = e_ews_item_get_modified_occurrences (item);
 		if (modified_occurrences) {
 			const EwsId *item_id = e_ews_item_get_id (l->data);
 
@@ -3213,7 +3226,7 @@ ews_cal_get_items_ready_cb (GObject *obj,
 	for (l = items; l != NULL; l = g_slist_next (l)) {
 		EEwsItem *item = (EEwsItem *) l->data;
 
-		if (item) {
+		if (item && e_ews_item_get_item_type (item) != E_EWS_ITEM_TYPE_ERROR) {
 			add_item_to_cache (cbews, item);
 			ews_get_attachments (cbews, item);
 			g_object_unref (item);
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index 291708a..4b37de4 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -472,7 +472,7 @@ camel_ews_folder_get_message (CamelFolder *folder,
 						  (ESoapProgressFn) camel_operation_progress,
 						  (gpointer) cancellable,
 						  cancellable, error);
-		if (!res) {
+		if (!res || (items_req && e_ews_item_get_item_type (items_req->data) == E_EWS_ITEM_TYPE_ERROR)) {
 			if (items_req) {
 				g_object_unref (items_req->data);
 				g_slist_free (items_req);
diff --git a/src/camel/camel-ews-utils.c b/src/camel/camel-ews-utils.c
index 376a8ee..66f13e0 100644
--- a/src/camel/camel-ews-utils.c
+++ b/src/camel/camel-ews-utils.c
@@ -934,6 +934,11 @@ camel_ews_utils_sync_updated_items (CamelEwsFolder *ews_folder,
 		const EwsId *id;
 		CamelEwsMessageInfo *mi;
 
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			g_object_unref (item);
+			continue;
+		}
+
 		id = e_ews_item_get_id (item);
 		mi = (CamelEwsMessageInfo *) camel_folder_summary_get (folder->summary, id->id);
 		if (mi) {
@@ -990,6 +995,11 @@ camel_ews_utils_sync_created_items (CamelEwsFolder *ews_folder,
 		if (!item)
 			continue;
 
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			g_object_unref (item);
+			continue;
+		}
+
 		id = e_ews_item_get_id (item);
 		mi = (CamelEwsMessageInfo *) camel_folder_summary_get (folder->summary, id->id);
 		if (mi) {
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index 57009b9..29170e3 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -55,7 +55,7 @@ static GHashTable *loaded_connections_permissions = NULL;
 static gboolean ews_next_request (gpointer _cnc);
 static gint comp_func (gconstpointer a, gconstpointer b);
 
-typedef void (*response_cb) (ESoapParameter *param, struct _EwsNode *enode);
+typedef void (*response_cb) (ESoapParameter *param, struct _EwsNode *enode, GError **in_error);
 static void ews_response_cb (SoupSession *session, SoupMessage *msg, gpointer data);
 
 static void	ews_connection_authenticate	(SoupSession *sess,
@@ -457,20 +457,24 @@ ews_response_cb (SoupSession *session,
 
 				if ((strcmp((char *)subparam->name, "FreeBusyResponse") == 0 && !ews_get_response_status (e_soap_parameter_get_first_child (subparam), &error)) ||
 				 (strcmp((char *)subparam->name, "FreeBusyResponse") && !ews_get_response_status (subparam, &error))) {
-					g_simple_async_result_set_from_error (enode->simple, error);
-					break;
-				}
-				if (enode->cb)
-					enode->cb (subparam, enode);
+					if (enode->cb) {
+						enode->cb (subparam, enode, &error);
+					} else {
+						g_simple_async_result_set_from_error (enode->simple, error);
+						break;
+					}
+				} else if (enode->cb)
+					enode->cb (subparam, enode, &error);
 			}
 		} else if ((param = e_soap_response_get_first_parameter_by_name (response, "ResponseMessage"))) {
 			/*Parse GetUserOofSettingsResponse and SetUserOofSettingsResponse*/
 			if (!ews_get_response_status (param, &error)) {
-					g_simple_async_result_set_from_error (enode->simple, error);
+				if (enode->cb)
+					enode->cb (NULL, enode, &error);
 			} else {
 				subparam = e_soap_parameter_get_next_child (param);
 				if (enode->cb)
-					enode->cb (subparam, enode);
+					enode->cb (subparam, enode, &error);
 			}
 		} else
 			ews_parse_soap_fault (response, &error);
@@ -577,28 +581,43 @@ sync_xxx_response_cb (ESoapParameter *subparam,
 
 static void
 sync_hierarchy_response_cb (ESoapParameter *subparam,
-                            EwsNode *enode)
+                            EwsNode *enode,
+			    GError **error)
 {
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	sync_xxx_response_cb (subparam, enode, (ItemParser) e_ews_folder_new_from_soap_parameter,
 			      "IncludesLastFolderInRange", "FolderId");
 }
 
 static void
 sync_folder_items_response_cb (ESoapParameter *subparam,
-                               EwsNode *enode)
+                               EwsNode *enode,
+			       GError **error)
 {
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	sync_xxx_response_cb (subparam, enode, (ItemParser) e_ews_item_new_from_soap_parameter,
 			      "IncludesLastItemInRange", "ItemId");
 }
 
 static void
 get_folder_response_cb (ESoapParameter *subparam,
-                        EwsNode *enode)
+                        EwsNode *enode,
+			GError **error)
 {
 	ESoapParameter *node;
 	EwsAsyncData *async_data;
 	EEwsFolder *folder;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
 	for (node = e_soap_parameter_get_first_child_by_name (subparam, "Folders");
@@ -611,7 +630,8 @@ get_folder_response_cb (ESoapParameter *subparam,
 
 static void
 find_folder_items_response_cb (ESoapParameter *subparam,
-                               EwsNode *enode)
+                               EwsNode *enode,
+			       GError **error)
 {
 	ESoapParameter *node, *subparam1;
 	EwsAsyncData *async_data;
@@ -620,6 +640,10 @@ find_folder_items_response_cb (ESoapParameter *subparam,
 	EEwsItem *item;
 	gboolean includes_last_item = FALSE;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	node = e_soap_parameter_get_first_child_by_name (subparam, "RootFolder");
 	total = e_soap_parameter_get_property (node, "TotalItemsInView");
 	total_items = atoi (total);
@@ -645,7 +669,8 @@ find_folder_items_response_cb (ESoapParameter *subparam,
 /* Used for CreateItems and GetItems */
 static void
 get_items_response_cb (ESoapParameter *subparam,
-                       EwsNode *enode)
+                       EwsNode *enode,
+		       GError **error)
 {
 	ESoapParameter *node;
 	EwsAsyncData *async_data;
@@ -655,10 +680,18 @@ get_items_response_cb (ESoapParameter *subparam,
 
 	for (node = e_soap_parameter_get_first_child_by_name (subparam, "Items");
 	     node; node = e_soap_parameter_get_next_child_by_name (subparam, "Items")) {
-		item = e_ews_item_new_from_soap_parameter (node);
+		if (node->children)
+			item = e_ews_item_new_from_soap_parameter (node);
+		else
+			item = NULL;
+		if (!item && error && *error)
+			item = e_ews_item_new_from_error (*error);
 		if (!item) continue;
 		async_data->items = g_slist_append (async_data->items, item);
 	}
+
+	/* do not stop on errors here, just use it above */
+	g_clear_error (error);
 }
 
 static gchar *
@@ -693,7 +726,8 @@ get_text_from_html (gchar *html_text)
 
 static void
 get_oof_settings_response_cb (ESoapParameter *subparam,
-                              EwsNode *enode)
+                              EwsNode *enode,
+			      GError **error)
 {
 	ESoapParameter *node, *node_1;
 	EwsAsyncData *async_data;
@@ -703,6 +737,10 @@ get_oof_settings_response_cb (ESoapParameter *subparam,
 	gchar *ext_msg = NULL, *int_msg = NULL;
 	GTimeVal time_val;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	node = e_soap_parameter_get_first_child_by_name (subparam, "OofState");
 	state = e_soap_parameter_get_string_value (node);
 
@@ -752,7 +790,8 @@ get_oof_settings_response_cb (ESoapParameter *subparam,
 
 static void
 resolve_names_response_cb (ESoapParameter *subparam,
-                           EwsNode *enode)
+                           EwsNode *enode,
+			   GError **error)
 {
 	ESoapParameter *node;
 	gboolean includes_last_item;
@@ -760,6 +799,10 @@ resolve_names_response_cb (ESoapParameter *subparam,
 	EwsAsyncData *async_data;
 	gchar *prop;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	subparam = e_soap_parameter_get_first_child_by_name (subparam, "ResolutionSet");
 	prop = e_soap_parameter_get_property (subparam, "IncludesLastItemInRange");
 
@@ -797,13 +840,18 @@ resolve_names_response_cb (ESoapParameter *subparam,
 
 static void
 expand_dl_response_cb (ESoapParameter *subparam,
-                       EwsNode *enode)
+                       EwsNode *enode,
+		       GError **error)
 {
 	gboolean includes_last_item;
 	GSList *mailboxes = NULL;
 	EwsAsyncData *async_data;
 	gchar *prop;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	subparam = e_soap_parameter_get_first_child_by_name (subparam, "DLExpansion");
 	prop = e_soap_parameter_get_property (subparam, "IncludesLastItemInRange");
 
@@ -830,14 +878,19 @@ expand_dl_response_cb (ESoapParameter *subparam,
 
 /* TODO scan all folders if we support creating multiple folders in the request */
 static void
-ews_create_folder_cb (ESoapParameter *soapparam,
-                      EwsNode *enode)
+ews_create_folder_response_cb (ESoapParameter *soapparam,
+			       EwsNode *enode,
+			       GError **error)
 {
 	ESoapParameter *param, *node;
 	EwsAsyncData *async_data;
 	EwsFolderId *fid = NULL;
 	GSList *fids = NULL;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	node = e_soap_parameter_get_first_child_by_name (soapparam, "Folders");
 	node = e_soap_parameter_get_first_child_by_name (node, "Folder");
 	param = e_soap_parameter_get_first_child_by_name (node, "FolderId");
@@ -3798,7 +3851,7 @@ e_ews_connection_create_folder_start (EEwsConnection *cnc,
 	g_simple_async_result_set_op_res_gpointer (
 		simple, async_data, (GDestroyNotify) async_data_free);
 
-	ews_connection_queue_request (cnc, msg, ews_create_folder_cb, pri, cancellable, simple, cb == ews_sync_reply_cb);
+	ews_connection_queue_request (cnc, msg, ews_create_folder_response_cb, pri, cancellable, simple, cb == ews_sync_reply_cb);
 }
 
 gboolean
@@ -4090,12 +4143,17 @@ e_ews_connection_delete_folder (EEwsConnection *cnc,
 
 static void
 create_attachments_response_cb (ESoapParameter *param,
-                                EwsNode *enode)
+                                EwsNode *enode,
+				GError **error)
 {
 	/* http://msdn.microsoft.com/en-us/library/aa565877%28v=EXCHG.80%29.aspx */
 	ESoapParameter *subparam, *attspara, *last_relevant = NULL, *attparam;
 	EwsAsyncData *async_data;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
 	attspara = e_soap_parameter_get_first_child_by_name (param, "Attachments");
@@ -4274,12 +4332,17 @@ e_ews_connection_create_attachments (EEwsConnection *cnc,
 /* Delete attachemnts */
 static void
 delete_attachments_response_cb (ESoapParameter *subparam,
-                                EwsNode *enode)
+                                EwsNode *enode,
+				GError **error)
 {
 	/* http://msdn.microsoft.com/en-us/library/aa580782%28v=EXCHG.80%29.aspx */
 	ESoapParameter *attspara;
 	EwsAsyncData *async_data;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
 	attspara = e_soap_parameter_get_first_child_by_name (subparam, "RootItemId");
@@ -4384,7 +4447,7 @@ e_ews_connection_delete_attachments (EEwsConnection *cnc,
 	return parents;
 }
 
-static void get_attachments_response_cb (ESoapParameter *subparam, EwsNode *enode);
+static void get_attachments_response_cb (ESoapParameter *subparam, EwsNode *enode, GError **error);
 
 void
 e_ews_connection_get_attachments_start (EEwsConnection *cnc,
@@ -4509,7 +4572,8 @@ e_ews_connection_get_attachments (EEwsConnection *cnc,
 
 static void
 get_attachments_response_cb (ESoapParameter *param,
-                             EwsNode *enode)
+                             EwsNode *enode,
+			     GError **error)
 {
 	ESoapParameter *subparam, *attspara;
 	EwsAsyncData *async_data;
@@ -4517,6 +4581,10 @@ get_attachments_response_cb (ESoapParameter *param,
 	EEwsItem *item;
 	const gchar *name;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
 	attspara = e_soap_parameter_get_first_child_by_name (param, "Attachments");
@@ -4544,7 +4612,8 @@ get_attachments_response_cb (ESoapParameter *param,
 
 static void
 get_free_busy_response_cb (ESoapParameter *param,
-                           EwsNode *enode)
+                           EwsNode *enode,
+			   GError **error)
 {
        /*parse the response to create a free_busy data
 	http://msdn.microsoft.com / en - us / library / aa564001 % 28v = EXCHG.140 % 29.aspx */
@@ -4557,6 +4626,10 @@ get_free_busy_response_cb (ESoapParameter *param,
 	gchar *value;
 	EwsAsyncData *async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	viewparam = e_soap_parameter_get_first_child_by_name (param, "FreeBusyView");
 	if (!viewparam) return;
 	vfb = icalcomponent_new_vfreebusy ();
@@ -4708,13 +4781,18 @@ get_permission_from_string (gchar *permission)
 
 static void
 get_delegate_response_cb (ESoapParameter *param,
-                          EwsNode *enode)
+                          EwsNode *enode,
+			  GError **error)
 {
 	ESoapParameter *subparam, *node, *child;
 	EwsAsyncData *async_data;
 	EwsDelegateInfo *data;
 	gchar *value;
 
+	/* stop on errors */
+	if (error && *error)
+		return;
+
 	async_data = g_simple_async_result_get_op_res_gpointer (enode->simple);
 
 	node = e_soap_parameter_get_first_child_by_name (param, "DelegateUser");
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 8fe1b28..698c5ba 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -143,6 +143,7 @@ struct _EEwsTaskFields {
 struct _EEwsItemPrivate {
 	EwsId *attachment_id;
 	EEwsItemType item_type;
+	GError *error;
 
 	/* MAPI properties */
 	/* The Exchange server is so fundamentally misdesigned that it doesn't expose
@@ -217,6 +218,8 @@ e_ews_item_dispose (GObject *object)
 
 	priv = item->priv;
 
+	g_clear_error (&priv->error);
+
 	if (priv->item_id) {
 		g_free (priv->item_id->id);
 		g_free (priv->item_id->change_key);
@@ -1098,6 +1101,19 @@ e_ews_item_new_from_soap_parameter (ESoapParameter *param)
 	return item;
 }
 
+EEwsItem *
+e_ews_item_new_from_error (const GError *error)
+{
+	EEwsItem *item;
+
+	g_return_val_if_fail (error != NULL, NULL);
+
+	item = g_object_new (E_TYPE_EWS_ITEM, NULL);
+	e_ews_item_set_error (item, error);
+
+	return item;
+}
+
 EEwsItemType
 e_ews_item_get_item_type (EEwsItem *item)
 {
@@ -1112,7 +1128,37 @@ e_ews_item_set_item_type (EEwsItem *item,
 {
 	g_return_if_fail (E_IS_EWS_ITEM (item));
 
-	item->priv->item_type = new_type;
+	/* once the type is set to error type it stays as error type */
+	if (item->priv->item_type != E_EWS_ITEM_TYPE_ERROR)
+		item->priv->item_type = new_type;
+}
+
+const GError *
+e_ews_item_get_error (EEwsItem *item)
+{
+	g_return_val_if_fail (E_IS_EWS_ITEM (item), NULL);
+
+	return item->priv->error;
+}
+
+void
+e_ews_item_set_error (EEwsItem *item,
+		      const GError *error)
+{
+	GError *new_error;
+
+	g_return_if_fail (E_IS_EWS_ITEM (item));
+
+	if (error)
+		new_error = g_error_copy (error);
+	else
+		new_error = NULL;
+
+	g_clear_error (&item->priv->error);
+	item->priv->error = new_error;
+
+	if (item->priv->error)
+		e_ews_item_set_item_type (item, E_EWS_ITEM_TYPE_ERROR);
 }
 
 const gchar *
diff --git a/src/server/e-ews-item.h b/src/server/e-ews-item.h
index 054aa3b..04be20d 100644
--- a/src/server/e-ews-item.h
+++ b/src/server/e-ews-item.h
@@ -49,7 +49,8 @@ typedef enum {
 	E_EWS_ITEM_TYPE_MEETING_RESPONSE,
 	E_EWS_ITEM_TYPE_MEETING_CANCELLATION,
 	E_EWS_ITEM_TYPE_TASK,
-	E_EWS_ITEM_TYPE_GENERIC_ITEM
+	E_EWS_ITEM_TYPE_GENERIC_ITEM,
+	E_EWS_ITEM_TYPE_ERROR
 } EEwsItemType;
 
 typedef enum {
@@ -114,10 +115,14 @@ typedef struct {
 GType		e_ews_item_get_type (void);
 EEwsItem *	e_ews_item_new_from_soap_parameter
 						(ESoapParameter *param);
+EEwsItem *	e_ews_item_new_from_error	(const GError *error);
 
 EEwsItemType	e_ews_item_get_item_type	(EEwsItem *item);
 void		e_ews_item_set_item_type	(EEwsItem *item,
 						 EEwsItemType new_type);
+const GError *	e_ews_item_get_error		(EEwsItem *item);
+void		e_ews_item_set_error		(EEwsItem *item,
+						 const GError *error);
 const gchar *	e_ews_item_get_subject		(EEwsItem *item);
 void		e_ews_item_set_subject		(EEwsItem *item,
 						 const gchar *new_subject);
diff --git a/src/server/ews-errors.c b/src/server/ews-errors.c
index 119453b..03bed9e 100644
--- a/src/server/ews-errors.c
+++ b/src/server/ews-errors.c
@@ -28,6 +28,7 @@ ews_conn_errors[] =
 	{"ErrorCalendarInvalidDayForTimeChangePattern",		EWS_CONNECTION_ERROR_CALENDARINVALIDDAYFORTIMECHANGEPATTERN},
 	{"ErrorCalendarInvalidDayForWeeklyRecurrence",		EWS_CONNECTION_ERROR_CALENDARINVALIDDAYFORWEEKLYRECURRENCE},
 	{"ErrorCalendarInvalidPropertyState",			EWS_CONNECTION_ERROR_CALENDARINVALIDPROPERTYSTATE},
+	{"ErrorCalendarInvalidPropertyValue",			EWS_CONNECTION_ERROR_CALENDARINVALIDPROPERTYVALUE},
 	{"ErrorCalendarInvalidRecurrence",			EWS_CONNECTION_ERROR_CALENDARINVALIDRECURRENCE},
 	{"ErrorCalendarInvalidTimeZone",			EWS_CONNECTION_ERROR_CALENDARINVALIDTIMEZONE},
 	{"ErrorCalendarIsDelegatedForAccept",			EWS_CONNECTION_ERROR_CALENDARISDELEGATEDFORACCEPT},
diff --git a/src/server/ews-errors.h b/src/server/ews-errors.h
index 54ded9e..86897e8 100644
--- a/src/server/ews-errors.h
+++ b/src/server/ews-errors.h
@@ -32,6 +32,7 @@ enum {
 	EWS_CONNECTION_ERROR_CALENDARINVALIDDAYFORTIMECHANGEPATTERN,
 	EWS_CONNECTION_ERROR_CALENDARINVALIDDAYFORWEEKLYRECURRENCE,
 	EWS_CONNECTION_ERROR_CALENDARINVALIDPROPERTYSTATE,
+	EWS_CONNECTION_ERROR_CALENDARINVALIDPROPERTYVALUE,
 	EWS_CONNECTION_ERROR_CALENDARINVALIDRECURRENCE,
 	EWS_CONNECTION_ERROR_CALENDARINVALIDTIMEZONE,
 	EWS_CONNECTION_ERROR_CALENDARISDELEGATEDFORACCEPT,
diff --git a/src/server/tests/test-syncfolder.c b/src/server/tests/test-syncfolder.c
index 885a410..b4dd79d 100644
--- a/src/server/tests/test-syncfolder.c
+++ b/src/server/tests/test-syncfolder.c
@@ -197,9 +197,16 @@ get_item_ready_callback (GObject *object,
 
 	for (l = items; l != NULL; l = g_slist_next (l)) {
 		EEwsItem *item = l->data;
-		const EwsId *id = e_ews_item_get_id (item);
 
-		g_print ("GetItem: Id is %s \n", id->id);
+		if (e_ews_item_get_item_type (item) == E_EWS_ITEM_TYPE_ERROR) {
+			const GError *error = e_ews_item_get_error (item);
+
+			g_print ("GetItem: Error '%s'\n", error ? error->message : "Unknown error");
+		} else {
+			const EwsId *id = e_ews_item_get_id (item);
+
+			g_print ("GetItem: Id is %s\n", id->id);
+		}
 	}
 
 	g_slist_foreach (items, (GFunc) g_object_unref, NULL);



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