Automatic configuration of mapping email headers to SharePoint properties and email headers search

harmon.ie Email Knowledge Base - Outlook

This article applies to harmon.ie version 8.2 or later.

Note: Before you begin, please read Save email headers in SharePoint and search for emails by email headers.

Starting from version 8.2, harmon.ie simplified the creation of email header mapping, using two new sample PowerShell scripts.

Notes:

  • The scripts require some SharePoint administrator knowledge and privileges.
  • The scripts can be run in site collections where email header mapping was never configured (including Teams and Groups site collections).
  • The Powershell scripts are provided only as a reference template, and they are not a part of the harmon.ie product.
  • An administrator may change the scripts.

To configure email header mapping and search, follow these steps:

  1. Make sure that the SharePointPnPPowerShellOnline module is installed.
  2. Download and extract harmonieEmailHeaderMapping.zip to a local folder on your computer.
  3. As a user with administrator privileges, run the CreateEmailType.ps1 script in each site collection you want to configure with email header mapping:
    CreateEmailType.ps1 [-URL <Site Url>] [-ContentType <Type name>] [-Exclude @("Col1","Col2",...)] [-Parent <Type name>], where:
    • The URL may be given as a parameter or template-commented in the script.
    • -ContentType creates a custom name for the email content type. Default name: Email.
    • -Exclude excludes specific email header from the content type. Use the Email Header name as defined in the email columns table.
    • -Parent can be used to supply the parent content type instead of the default content type.
    Example: CreateEmailType.ps1 -ContentType Email -Exclude @("ConversationIndex", "MailPreviewData")
    The script does the following:
    • Creates email columns in your SharePoint site, for email header mapping. SharePoint automatically creates managed properties and crawled properties for each created email column.
    • For each email column that can be used for search, the script maps the managed property to the matching crawled property, to enable the search.
    • Creates an email content type with the email columns.
  4. Run the AddEmailType.ps1 script, in each list or library you want to configure with email header mapping:
    AddEmailType.ps1 [-URL <Site Url>] [-List <Document Library>] [-ContentType <Type name>], where:
    • The URL may be given as a parameter or template-commented in the script.
    • -List adds the content type to the given document library or list. Default library: Shared Documents.
    • -ContentType adds a custom email content type. Default name: Email.
    The script adds the email content type to the SharePoint library or list you want to configure with email header mapping.
  5. Re-index the SharePoint site. This process my take a few hours when run for the first time.
  6. Set the EnableEmailSearch provisioning key to True in all users' machines, and instruct them to restart Outlook. You may use this sample registry file for assistance.

Notes:

SharePoint columns used for email header mapping:

The CreateEmailType.ps1 script creates the following SharePoint columns:

EMAIL HEADER SHAREPOINT PROPERTY TYPE DESCRIPTION
Attachments hrmAttachments Single line of text or Yes/No Indicates if the email message contains attachments. The default value should be No.
Categories hrmCategories Multiple lines of text Message categories.
Cc hrmCc Multiple lines of text The identity of the secondary recipients of the message.
Bcc hrmBcc Multiple lines of text The identity of the blind recipients of the message. This field is saved to SharePoint only if explicitly set by the administrator.
ConversationIndex hrmConversationIndex Single line of text A unique identifier for the conversation.
ConversationTopic hrmConversationTopic Single line of text The common subject of the email thread. This column facilitates creating a SharePoint view to show related emails. Read Grouping email messages for more information.
Date hrmDate Date and Time The date and time when the message was sent.
From hrmFrom Single line of text The address of the message sender.
Importance hrmImportance Single line of text The message’s importance.
InReplyTo hrmInReplyTo Single line of text The contents of this field identify previous correspondence that this message answers.
MessageID hrmMessageID Single line of text A unique identifier for the message.
MessageClass hrmMessageClass Single line of text The type of the item (message, appointment, post, etc.). Used to show the correct item icon. Read Assign icons to uploaded Outlook items to learn more.
MailPreviewData hrmMailPreviewData Multiple lines of text Stores the message content compressed, for the Show Preview command. It is recommended to set this column with Allow unlimited length in document libraries set to Yes, and Add to default view unchecked (to hide the column). Read Enable email previewing to learn more.
Received hrmReceived Date and Time The date and time when a message is received.
References hrmReferences Single line of text The contents of this field identify other correspondence that this message answers.
ReplyTo hrmReplyTo Single line of text Indicates any mailbox(es) to which responses are to be sent.
Subject hrmSubject Single line of text The subject of the message.
Sensitivity hrmSensitivity Single line of text The message’s sensitivity.
To hrmTo Multiple lines of text The identity of the primary recipients of the message.

Note: All multiple line properties are defined as plain text.

Mapping of custom managed properties to search columns

This table lists the default managed properties created by harmon.ie for search columns, and the crawled properties mapped to them.

MANAGED PROPERTY CRAWLED PROPERTY
hrmFromOWSTEXT ows_q_TEXT_hrmFrom
hrmToOWSMTXT ows_r_MTXT_hrmTo
hrmSubjectOWSTEXT ows_q_TEXT_hrmSubject
hrmCcOWSMTXT ows_r_MTXT_hrmCc