Just looking to draft an email from template, add attachments and display to user
I used “Send Outlook Mail Message” activity … body from template as well as adding attachments was easy
however, after message is saved in drafts folder (used “is draft” option) and not displayed for user
I tried searching, but seems as most automations are for unattended processes and without using “invoke code” this doesn’t appear to be a feature of any of the activities
so question, is there a way to display drafted email I just created and have customer add an additional details before sending (without using unofficial libraries) ?
In UiPath, the standard activities for sending emails are primarily designed for unattended automation processes and often don’t provide a direct method for displaying a drafted email to the user with the ability to add additional details before sending
you can follow this steps
Use Outlook Interaction: Instead of using the “Send Outlook Mail Message” activity, which is designed for automated sending, you can use Outlook interaction activities to create and display the email draft to the user.
2.Create Email Draft: Use Outlook interaction activities to create a new email draft, set the subject, recipient, body, and attachments as needed. You can use the “Outlook” activities package in UiPath, which provides a range of activities for interacting with Outlook.
Display the Draft: After creating the draft, use an activity to display it in the user’s Outlook email client. This can be achieved using the “Send Outlook Mail Message” activity if your use case allows for this interaction with the user. Set the “IsDraft” option to true.
4.User Interaction: The user will be able to view the drafted email in their Outlook client, add additional details, make edits, and send the email manually.
In UiPath, you can create a draft email from a template, add attachments, and then display it to the user for further editing before sending it. You don’t necessarily need to use unofficial libraries or invoke code activities for this task. You can achieve this using the built-in “Send Outlook Mail Message” activity along with a few additional steps. Here’s a step-by-step guide:
Send Outlook Mail Message (Compose the email and set IsDraft = True)
Get Outlook Mail Messages (Retrieve the draft email)
Display email to the user for editing (e.g., using an Input Dialog)
User makes changes if necessary
Send Outlook Mail Message (Send the updated email)
Display email to the user for editing (e.g., using an Input Dialog)
User makes changes if necessary
Send Outlook Mail Message (Send the updated email)
not sure how I feel about this … this just confuses user, they use outlook every day so email sitting waiting to be sent is nothing new… bunch of prompts asking questions … don’t really find that useful
With attended, that would be very risky, I think I’ll go with the code route
not much to this really
Dim mail As Microsoft.Office.Interop.Outlook.MailItem
code for attachments, subject, etc
than to dislay
mail.Display
just mad at UiPath Dev team really… this is the first time that I’m doing attended
I was 100% sure this is some checkmark on some outlook activity that I am missing
Let me know if you actually get that to work. It throws an exception for me. I don’t think you can use code within an Invoke Code to get the email to open from Outlook.
Dim outlook As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application()
Dim ns As Microsoft.Office.Interop.Outlook.NameSpace = outlook.GetNamespace("MAPI")
Dim mailItem As Microsoft.Office.Interop.Outlook.MailItem = DirectCast(outlook.CreateItem(OlItemType.olMailItem), Microsoft.Office.Interop.Outlook.MailItem)
mailItem.Subject = "Test"
mailItem.Recipients.Add("test@test.com")
mailItem.Recipients.ResolveAll()
mailItem.Display(mailItem)
mailItem.HTMLBody = "test"
Marshal.ReleaseComObject(mailItem)
Marshal.ReleaseComObject(ns)
Marshal.ReleaseComObject(outlook)
GC.Collect()
GC.WaitForPendingFinalizers()
@uipath can we have enhancement to one of the Outlook packages
if “is draft” is selected add “is visible” or something