cancel
Showing results for 
Search instead for 
Did you mean: 

SAP iRPA - How to use Outlook replyAll()

former_member688751
Discoverer

Hello Expert,

Could anyone give an example about ctx.outlook.mail.replyAll? I try to use it. ฺBut it doesn’t work for reply. It's like create new email.

My workflow use for retrieve email and download attached files to my PC and use ctx.outlook.mail.replyAll for a reply to same my collection.

This is my scripts that use for work the process.

 // Outlook
function readMail(){

  // Outlook Init
  ctx.outlook.init();

  // Resets the working mails list.
  ctx.outlook.mail.resetMailCollection();
  
  //SearchByCriteria
  ctx.outlook.mail.searchByCriteria({
  subject : "Demo%",
  read : 0,
  maxRow : 20
  });

  var mails = ctx.outlook.mail.getFilteredTable(); //Get Filtered email

  //Loop mails for do Activities
  ctx.log("Mail length: " + mails.length,e.logIconType.Info);
  for(var i = 0; i < mails.length; i++){
    ctx.outlook.mail.retrieveMail({EntryID : mails[i]['EntryID'], StoreID : mails[i]['StoreID']});
  }
  //for Same mail index
  for (var i = 0; i<ctx.outlook.mail.getCollectionLength(); i++){
    for (var j=0;j<ctx.outlook.mail.getAttachmentsCount((i));j++){ 
      ctx.outlook.mail.attachmentSave(i, "C:\\temp\\" + ctx.outlook.mail.getAttachmentsName(i)[j],{Index : ++j} );
    }
    //Reply by same Collection
    ctx.outlook.mail.setBody(i,"Download File Successfuls.");
    ctx.outlook.mail.replyAll(i);
    ctx.outlook.mail.send(i);                                 
  }
  //Outlook End
  ctx.outlook.end();
}

From my script, it can download the attached files. However, the replyAll() step will send email with the same information that stores in my collections and change body to “Download File Successful.”. Sender is also same from my collection. It's not change my email address in outlook to sender. It’s not take the old body email to use for reply.

Please help me to solve this problem.

Thank you.

Best regards.

former_member679150
Discoverer
0 Kudos

I have same problem.Anyone give some example please

Accepted Solutions (0)

Answers (1)

Answers (1)

AllanGarcia55
Participant

Maybe it is missing the word task:

https://contextor.eu/dokuwiki2/doku.php?id=lib:office:outlook#ctx_outlook_mail_replyall

res = ctx.outlook.task.replyAll( 0 );