<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<synchronization>
	<external_system_type>ExchangeWebServices</external_system_type>
	
	<!-- '2010' for Exchange 2010 -->
	<external_system_version>2010</external_system_version>

	<!-- Comment a résoudre une conflit
	   E-DEAL - L'objet e-DEAL gagne.
	   EXTERNAL - l'objet External gagne.
	   LAST - l'objet plus récente gagne. -->
	<conflict_resolution>E-DEAL</conflict_resolution>

	<!-- 'true' pour s'afficher les message debug pendant une synchronization -->
	<verbose_debug>true</verbose_debug>
	
	<!--
		'true' si les rendez-vous privés sont synchronisés
	-->
	<synchronize_private_appointments>false</synchronize_private_appointments>
	
	<!--
		Code de l'activité d'interaction utilisée pour les rendez-vous privés
	-->
	<private_appointment_activity>PERRDV</private_appointment_activity>
	
	<!--
		Sujet d'interaction utilisé pour les rendez-vous privés
	-->
	<private_appointment_subject>Personnel</private_appointment_subject>
	
	<!--
		'true' si les téches privées sont synchronisées
	-->
	<synchronize_private_tasks>true</synchronize_private_tasks>
	
	<!--
		Code de l'activité d'interaction utilisée pour les tâches privées
	-->
	<private_task_activity>PERTASK</private_task_activity>
	
	<!--
		Sujet d'interaction utilisé pour les tâches privées
	-->
	<private_task_subject>Tâche personnelle</private_task_subject>
	
	<!--
		'true' si les rendez-vous créés par des uses non synchronisés
		sont synchronisés
	-->
	<synchronize_appointments_from_other_users>false</synchronize_appointments_from_other_users>

	<!-- 
		Whether or not we want to synchronize the correspondants of RDVs. This variable
		is only used for Webdav configurations. Possible values are:
		INCOMING - Correspondants will only be copied from Exchange to EDEAL
		OUTGOING - Correspondants will only be copied from EDEAL to Exchange
		BOTH - All correspondants are copied
		NONE - No correspondants are copied (default value if nothing is specified)
	-->
	<correspondant_handling>INCOMING</correspondant_handling>

	<connection>
		<!-- Login Windows du compte utilisé pour se connecter à Exchange 
	      (il doit avoir la droit d'impersonation sur les BALs des utilisateurs synchronisés) -->
		<connection_param name="username" value="login"/>
		<connection_param name="password" value="password"/>

		<!-- Le domaine Windows auquel appartient l'utilisateur ci-dessus -->
		<connection_param name="domain" value="domain"/>

		<!-- La connexion au serveur Exchange - http:// ou https:// -->
		<connection_param name="connection_prefix" value="http://"/>
		<connection_param name="servername" value="server"/>
		<connection_param name="DateFormat" value="yyyy-MM-dd'T'HH:mm:ss"/> 
		<connection_param name="DateFormatTimezone" value="GMT"/> 
	</connection>

	<sync_objects>
		<object name="ContactDefault" synctype="out" type="Contact">
			<edeal_class>Person</edeal_class>
			<edeal_select>
				<!-- La requête suivante est un exemple. Il faut la modifier pour correspondre à votre base des données -->
				<select_param name="query"><![CDATA[
					select distinct PerID from Person, Enterprise, Actor
					where PerEntID = EntID and EntActID = ActID and ActLogin = $$login$$
				]]></select_param>
			</edeal_select>
		</object>

		<object name="AppointmentDefault" synctype="bi" type="Appointment">
			<edeal_class>Interaction</edeal_class>
			<edeal_select>
				<!-- La requête suivante est un exemple. Il faut la modifier pour correspondre à votre base des données -->
				<select_param name="query"><![CDATA[
						SELECT DISTINCT IntID FROM Interaction, Actor, RefValues
						where IntEmetteur = ActID AND ActLogin = $$login$$ 
						AND IntDate IS NOT NULL AND IntTimeBeg IS NOT NULL 
						AND IntTimeEnd IS NOT NULL 
						AND IntDate > getdate() - 15 
						AND IntDate < getdate() + 30 
						AND IntAtvID = RefID AND RefVal <> 'NOTE'
				]]></select_param>
				<select_param name="cor_query"><![CDATA[
            SELECT EntID, PerID
            FROM Enterprise
            left outer join Person on EntID = PerEntID
            LEFT OUTER JOIN RefValues ON  PerCivID = RefID
            WHERE
            (
            ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
            ISNULL(PerName + ' ', '') + ISNULL('(' +  EntCorpName + ')', '') =  ?
            or
            ISNULL(PerFstName +  ' ', '') +
            ISNULL(PerName + ' ', '') + ISNULL('('  + EntCorpName + ')', '') = ?
            )
            UNION
            SELECT EntID, null
            FROM  Enterprise
            WHERE ISNULL('(' + EntCorpName + ')', '') =  ?
            UNION
            select null,PerID
            From person
            LEFT OUTER JOIN RefValues ON  PerCivID = RefID
            where
            (
            ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
            ISNULL(PerName + ' ', '') + '(' + ')' =  ?
            or
            ISNULL(PerFstName +  ' ', '') +
            ISNULL(PerName + ' ', '') + '(' + ')' = ?
            or
            ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
            ISNULL(PerName, '') =  ?
            or
            ISNULL(PerFstName +  ' ', '') +
            ISNULL(PerName, '') = ?
            )
				]]></select_param>
				<select_param name="cor_query_nb_params">7</select_param>
				<select_param name="cor_query_columns">CorEntID,CorPerID</select_param>
			</edeal_select>
			<external_select>
				<select_param name="from">-15</select_param>
				<select_param name="to">30</select_param>
			</external_select>
		</object>
		
		<object name="TaskDefault" synctype="bi" type="Task">
			<edeal_class>Interaction</edeal_class>
			<edeal_select>
				<!-- La requête suivante est un exemple. Il faut la modifier pour correspondre à votre base des données -->
				<select_param name="query"><![CDATA[
							SELECT DISTINCT IntID FROM Interaction, Actor, RefValues
							where IntEmetteur = ActID AND ActLogin = $$login$$ 
							AND IntDate IS NOT NULL 
							AND IntDate > getdate() - 15 
							AND IntDate < getdate() + 30 
							AND IntAtvID = RefID AND RefVal = 'NOTE'
				]]></select_param>
				<select_param name="cor_query"><![CDATA[
              SELECT EntID, PerID
              FROM Enterprise
              left outer join Person on EntID = PerEntID
              LEFT OUTER JOIN RefValues ON  PerCivID = RefID
              WHERE
              (
              ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
              ISNULL(PerName + ' ', '') + ISNULL('(' +  EntCorpName + ')', '') =  ?
              or
              ISNULL(PerFstName +  ' ', '') +
              ISNULL(PerName + ' ', '') + ISNULL('('  + EntCorpName + ')', '') = ?
              )
              UNION
              SELECT EntID, null
              FROM  Enterprise
              WHERE ISNULL('(' + EntCorpName + ')', '') =  ?


              UNION
              select null,PerID
              From person
              LEFT OUTER JOIN RefValues ON  PerCivID = RefID
              where
              (
              ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
              ISNULL(PerName + ' ', '') + '(' + ')' =  ?
              or
              ISNULL(PerFstName +  ' ', '') +
              ISNULL(PerName + ' ', '') + '(' + ')' = ?
              or
              ISNULL(RefTe1 + ' ', '') + ISNULL(PerFstName + ' ', '') +
              ISNULL(PerName, '') =  ?
              or
              ISNULL(PerFstName +  ' ', '') +
              ISNULL(PerName, '') = ?
              )
				]]></select_param>
				<select_param name="cor_query_nb_params">7</select_param>
				<select_param name="cor_query_columns">CorEntID,CorPerID</select_param>
			</edeal_select>
			<external_select>
				<select_param name="from">-05</select_param>
				<select_param name="to">30</select_param>
			</external_select>
		</object>
	</sync_objects>
</synchronization>