How to identify IRM Email in outlook

Hi,

How to identify an incoming IRM (encrypted) email in outlook. Is there any specific activity to identify?

TIA,
Ramya A

Hi @ramya_anbazhagan

Can you pls check below link , might be helpful,
https://stackoverflow.com/questions/77500677/how-to-recognize-signed-encrypted-mails-in-outlooks

Happy Automation

  • Use Get Outlook Mail Messages: Retrieve the mail messages.
  • Iterate and Check MailMessage Properties:
  • Loop through each MailMessage object.
  • Access its .Properties collection. For IRM, you’re looking for an internal property that indicates rights management. The most reliable is often a property related to permissions.
  • Check MailMessage.PermissionTemplateID: This is a key property for IRM-protected emails. If it has a value (i.e., not null or empty), the email is likely IRM-protected.
  • Check MailMessage.IsRestricted (Less common, but can exist): Some versions or scenarios might expose a boolean IsRestricted property.
  • Check MailMessage.PropertyAccessor for MAPI Properties: For more advanced cases, you can use MailMessage.PropertyAccessor.GetProperty() with specific MAPI property tags that indicate IRM. This is more technical. A common MAPI property for IRM is http://schemas.microsoft.com/mapi/proptag/0x0078001E (PR_CURRENT_VERSION_NAME_IRMLOC).
  1. Using Outlook Interop (via Invoke Code activity):
    To properly detect IRM, you’ll need to access Outlook COM Object Model via Invoke Code activity:
    Below code ref.
    using Microsoft.Office.Interop.Outlook;
    using System;

class Program
{
static void Main()
{
Application app = new Application();
NameSpace ns = app.GetNamespace(“MAPI”);
MAPIFolder inbox = ns.GetDefaultFolder(OlDefaultFolders.olFolderInbox);

    Items items = inbox.Items;

    foreach (object item in items)
    {
        if (item is MailItem mail)
        {
            if (mail.IsIRMProtected)
            {
                Console.WriteLine("IRM Email Found: " + mail.Subject);
            }
        }
    }
}

}