diff --git a/bin/exportSeda/batch_tools.php b/bin/exportSeda/batch_tools.php
index a08645906e8d9fc45be8361d4e9bbbdcebca3e4e..1ac1d61135575654367e3f1d5799259c7d88c3ee 100644
--- a/bin/exportSeda/batch_tools.php
+++ b/bin/exportSeda/batch_tools.php
@@ -140,39 +140,6 @@ function Bt_writeLog($args = [])
     ]);
 }
 
-function Bt_createAttachment($args = [])
-{
-    $opts = [
-        CURLOPT_URL => rtrim($GLOBALS['applicationUrl'], "/") . '/rest/attachments',
-        CURLOPT_HTTPHEADER => [
-            'accept:application/json',
-            'content-type:application/json',
-            'Authorization: Basic ' . base64_encode($GLOBALS['userWS']. ':' .$GLOBALS['passwordWS']),
-        ],
-        CURLOPT_RETURNTRANSFER => true,
-        CURLOPT_SSL_VERIFYPEER => false,
-        CURLOPT_POSTFIELDS => json_encode($args),
-        CURLOPT_POST => true
-    ];
-
-    $curl = curl_init();
-    curl_setopt_array($curl, $opts);
-    $rawResponse = curl_exec($curl);
-    $error       = curl_error($curl);
-    if (!empty($error)) {
-        Bt_writeLog(['level' => 'ERROR', 'message' => $error]);
-        exit;
-    }
-
-    $return = json_decode($rawResponse, true);
-    if (!empty($return['errors'])) {
-        Bt_writeLog(['level' => 'ERROR', 'message' => $return['errors']]);
-        exit;
-    }
-
-    return $return;
-}
-
 function Bt_getReply($args = [])
 {
     $refEncode = str_replace('.', '%2E', urlencode($args['reference']));
diff --git a/bin/exportSeda/checkAllReplies.php b/bin/exportSeda/checkAllReplies.php
index d445f23d99b21aa94297d391505f49ef64c64636..e2411eb7e8c9bf2f872d1ed219e4dfa9d58564ad 100755
--- a/bin/exportSeda/checkAllReplies.php
+++ b/bin/exportSeda/checkAllReplies.php
@@ -26,7 +26,7 @@ class IncludeFileError extends Exception
 }
 
 // Globals variables definition
-$GLOBALS['batchName']    = 'checkAllRepliesFromArchivingSystem';
+$GLOBALS['batchName']    = 'checkRepliesFromArchivingSystem';
 $GLOBALS['wb']           = '';
 $totalProcessedResources = 0;
 
@@ -128,6 +128,7 @@ $replies = array_column($replies, 'res_id_master');
 $pendingResources = array_diff($acknowledgements, $replies);
 
 $unitIdentifiers = [];
+$nbMailsRetrieved = 0;
 foreach ($pendingResources as $resId) {
     $unitIdentifier = \MessageExchange\models\MessageExchangeModel::getUnitIdentifierByResId(['select' => ['message_id', 'res_id'], 'resId' => (string)$resId]);
     if (empty($unitIdentifier[0]['message_id'])) {
@@ -151,19 +152,30 @@ foreach ($pendingResources as $resId) {
             continue;
         }
 
-        //créer message reply & sauvegarder xml
         $resIds = explode(',', $value);
         $data   = json_decode($messages->replyMessage->data);
 
-        // TODO save reply
-        // $archiveTransferReply = new ArchiveTransferReply();
-        // $archiveTransferReply->receive($data, $resIds);
+        // TODO GET XML
+        $pathToDocument = 'xmlFile';
+
         foreach ($resIds as $resId) {
+            $id = Resource\controllers\StoreController::storeAttachment([
+                'encodedFile'   => base64_encode(file_get_contents($pathToDocument)),
+                'type'          => 'reply_record_management',
+                'resIdMaster'   => $resId,
+                'title'         => 'Réponse au transfert',
+                'format'        => 'xml',
+                'status'        => 'TRA'
+            ]);
+            if (empty($id) || !empty($id['errors'])) {
+                return ['errors' => ['[storeAttachment] ' . $id['errors']]];
+            }
             \Resource\models\ResModel::update([
                 'set'   => ['status' => $GLOBALS['statusReplyReceived']],
                 'where' => ['res_id = ?'],
                 'data'  => [$resId]
             ]);
+            $nbMailsRetrieved++;
         }
     }
 }