Flag email as "High Priority" in Send outlook mail

I need to use Send outlook mail and it should be flagged as High Priority. Is there any property that can be used to do that?
I can do it using outlook front end- i.e. Open outlook,paste mail contents,click on high priority on top right,send
But there are many mails to be processed, so need to find a backend solution.
It can be done with mailMessage.Priority= MailPriority.High
But when assigning it before the SendOutlook mai activity, it is giving Null object reference error.

Have you initialized the mail message variable?

New MailMessage()

circled in red below

1 Like

@akhi_s27
Thanks!!
I was doing the same thing-- it was giving error
The trick is to not include msgMailMessage variable in the Forward property.
And i attached the body as (in Assign) msgMailMessage.Body=“This will contain the mail content”
(in send outlook message)-- Body = msgMailMessage.Body
just to make sure that msgMailMessage gets assigned to Send outlook message activity.

Problem is still not resolved-- not able to see high priority in the mail received. :sob:

1 Like

This is not working for me.

@akhi_s27
Yes, i have done that. Still its not working

1 Like

Yes… I see that’s not working.
@UiPath need help here.

I had contacted Helpdesk for this issue. This is their reply

Hello,
Thanks for contacting UiPath,

As per the existing functionality in UiPath Outlook Automation there exists no way to parameterise the Priority of the email sent.

Alternatively, we can use the below techniques

  1. Use UI Automation to send email through Outlook.
    Please find below some useful links for UiPath recorders
    RPA Video Tutorials | UiPath
    Work with UI Elements for UI Automation with Studio

  2. Use Custom activities/code to trigger email from Outlook
    Refer the following link for more details → https://www.uipath.com/kb-articles/how-to-create-a-custom-activity

If you are using Invoke code activity this can be done. Use the below code.

Dim OutlookApp As Microsoft.Office.Interop.Outlook._Application
OutlookApp = New Microsoft.Office.Interop.Outlook.ApplicationClass
Dim mail As Microsoft.Office.Interop.Outlook.MailItem = DirectCast(OutlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem), Microsoft.Office.Interop.Outlook.MailItem)
mail.Subject = “Test Email”
mail.Body = “Test Email”
mail.To = “emailID”
mail.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh
mail.send()

You’ll have to import outlook interop namespace as well.
Let me know if it works.

1 Like

High Importance flag in outlook

Check this!!

Hi @midhunsug661 this coded works for me , but i want to add message body isHTML = true how should do , am holding HTML content into .TXT file & passing it to email body.

Dim OutlookApp As Microsoft.Office.Interop.Outlook._Application
OutlookApp = New Microsoft.Office.Interop.Outlook.ApplicationClass
Dim mail As Microsoft.Office.Interop.Outlook.MailItem = DirectCast(OutlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem), Microsoft.Office.Interop.Outlook.MailItem)
mail.Subject =subject
mail.IsBodyHtml = True
mail.Body = body
mail.To = reciver
mail.Attachments.Add(attachments)
mail.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh
mail.send()


can you help me to solve this .

Thanks in advance
:slight_smile:

Hi @midhunsug661

Can you please help me with the same as i am getting below error. I have also imported the mentioned namespace. but still getting error.

Hello @reetmehta , Sorry I just saw the post. Do you still face the issue? If so, please send the code, so I can have a look at it.