ebb_ews_download_gal_file (EBookBackendEws *bbews,
			   EwsOALDetails *full,
			   GCancellable *cancellable,
			   GError **error)
{
	EEwsConnection *oab_cnc;
	gchar *full_url, *oab_url;
	gchar *download_path = NULL;
	gchar *password;
	CamelEwsSettings *ews_settings;
	const gchar *cache_dir;

	ews_settings = ebb_ews_get_collection_settings (bbews);

	/* oab url with oab.xml removed from the suffix */
	oab_url = camel_ews_settings_dup_oaburl (ews_settings);
	if (!oab_url || !*oab_url) {
		g_free (oab_url);
		return NULL;
	}

	if (g_str_has_suffix (oab_url, "oab.xml"))
		oab_url [strlen (oab_url) - 7] = '\0';

	full_url = g_strconcat (oab_url, full->filename, NULL);
	cache_dir = e_book_backend_get_cache_dir (E_BOOK_BACKEND (bbews));
	download_path = g_build_filename (cache_dir, full->filename, NULL);

	oab_cnc = e_ews_connection_new_for_backend (E_BACKEND (bbews), e_book_backend_get_registry (E_BOOK_BACKEND (bbews)), full_url, ews_settings);

	e_binding_bind_property (
		bbews, "proxy-resolver",
		oab_cnc, "proxy-resolver",
		G_BINDING_SYNC_CREATE);

	password = e_ews_connection_dup_password (bbews->priv->cnc);
	e_ews_connection_set_password (oab_cnc, password);
	g_free (password);

	if (!e_ews_connection_download_oal_file_sync (oab_cnc, download_path, NULL, NULL, cancellable, error)) {
		g_free (download_path);
		download_path = NULL;
	} else {
		d (printf ("OAL file downloaded %s\n", download_path));
	}

	g_object_unref (oab_cnc);
	g_free (oab_url);
	g_free (full_url);

	return download_path;
}
ebb_ews_download_gal_file (EBookBackendEws *bbews,
			   EwsOALDetails *full,
			   GCancellable *cancellable,
			   GError **error)
{
	EEwsConnection *oab_cnc;
	gchar *full_url, *oab_url;
	gchar *download_path = NULL;
	gchar *password;
	CamelEwsSettings *ews_settings;
	const gchar *cache_dir;

	ews_settings = ebb_ews_get_collection_settings (bbews);

	 
	oab_url = camel_ews_settings_dup_oaburl (ews_settings);
	if (!oab_url || !*oab_url) {
		g_free (oab_url);
		return NULL;
	}

	if (g_str_has_suffix (oab_url, "oab.xml"))
		oab_url [strlen (oab_url) - 7] = '\0';

	full_url = g_strconcat (oab_url, full->filename, NULL);
	cache_dir = e_book_backend_get_cache_dir (E_BOOK_BACKEND (bbews));
	download_path = g_build_filename (cache_dir, full->filename, NULL);

	oab_cnc = e_ews_connection_new_for_backend (E_BACKEND (bbews), e_book_backend_get_registry (E_BOOK_BACKEND (bbews)), full_url, ews_settings);

	e_binding_bind_property (
		bbews, "proxy-resolver",
		oab_cnc, "proxy-resolver",
		G_BINDING_SYNC_CREATE);

	password = e_ews_connection_dup_password (bbews->priv->cnc);
	e_ews_connection_set_password (oab_cnc, password);
	g_free (password);

	if (!e_ews_connection_download_oal_file_sync (oab_cnc, download_path, NULL, NULL, cancellable, error)) {
		g_free (download_path);
		download_path = NULL;
	} else {
		d (printf ("OAL file downloaded %s\n", download_path));
	}

	g_object_unref (oab_cnc);
	g_free (oab_url);
	g_free (full_url);

	return download_path;
}