读取 Azure 信息保护统一标签客户端在 Outlook 电子邮件中设置的 Internet headers
Reading internet headers set in an Outlook email by Azure Information Protection Unified Labeling Client
我正在使用 Azure 信息保护统一标签客户端来标记电子邮件。我们仍在我们的环境中使用 PGP,严格保密的电子邮件必须经过 PGP 加密。
当邮件发送时,我试图找出邮件是如何分类并触发PGP加密的,分类是严格保密的。这是在 Outlook VSTO c# Add-in.
中完成的
为了找出分类,我阅读了由 AIP 设置并包含所有必要信息的电子邮件 header 属性 "msip_labels"。我正在使用以下过程来读取 headers。代码远非完美。我只是想知道如何获得价值。:
private void GetHeaders()
{
var mail = (Outlook.MailItem)Application.ActiveInspector().CurrentItem;
var propertyAccessor = mail.PropertyAccessor;
try
{
var custom = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/msip_labels");
}
catch(Exception ex)
{
var message = ex.Message;
}
}
我能够读取由另一个工具设置的属性,但是 AIP 属性 是多行的。执行代码时,出现错误:Typeconflict。 (HRESULT 异常:0x80020005 (DISP_E_TYPEMISMATCH))
有没有办法读取多值属性?这是 msip_labels 属性 的示例(GUID 替换为 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX):
msip_labels: MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Enabled=true;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_SetDate=2019-11-14T07:16:38Z;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Method=Privileged;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Name=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_SiteId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_ActionId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_ContentBits=1
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_enabled: true
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_setdate: 2019-11-14T07:16:48Z
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_method: Privileged
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_name:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_siteid:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_actionid:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_contentbits: 0
我终于想通了,如何创建 属性 架构字符串,使其 returns 成为正确的数据类型。使用 Outlook Spy 分析项目有助于找出数据类型。用于查询 msip_labels 的具有正确架构字符串的正确代码行是:
var mSIPLabels = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/msip_labels/0x0000001F") as string;
在 属性 名称之后,我必须传递类型描述符 0x0000001F
我正在使用 Azure 信息保护统一标签客户端来标记电子邮件。我们仍在我们的环境中使用 PGP,严格保密的电子邮件必须经过 PGP 加密。
当邮件发送时,我试图找出邮件是如何分类并触发PGP加密的,分类是严格保密的。这是在 Outlook VSTO c# Add-in.
中完成的为了找出分类,我阅读了由 AIP 设置并包含所有必要信息的电子邮件 header 属性 "msip_labels"。我正在使用以下过程来读取 headers。代码远非完美。我只是想知道如何获得价值。:
private void GetHeaders()
{
var mail = (Outlook.MailItem)Application.ActiveInspector().CurrentItem;
var propertyAccessor = mail.PropertyAccessor;
try
{
var custom = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/msip_labels");
}
catch(Exception ex)
{
var message = ex.Message;
}
}
我能够读取由另一个工具设置的属性,但是 AIP 属性 是多行的。执行代码时,出现错误:Typeconflict。 (HRESULT 异常:0x80020005 (DISP_E_TYPEMISMATCH))
有没有办法读取多值属性?这是 msip_labels 属性 的示例(GUID 替换为 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX):
msip_labels: MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Enabled=true;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_SetDate=2019-11-14T07:16:38Z;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Method=Privileged;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_Name=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_SiteId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_ActionId=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX;
MSIP_Label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_ContentBits=1
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_enabled: true
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_setdate: 2019-11-14T07:16:48Z
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_method: Privileged
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_name:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_siteid:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_actionid:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
msip_label_XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX_contentbits: 0
我终于想通了,如何创建 属性 架构字符串,使其 returns 成为正确的数据类型。使用 Outlook Spy 分析项目有助于找出数据类型。用于查询 msip_labels 的具有正确架构字符串的正确代码行是:
var mSIPLabels = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/string/{00020386-0000-0000-C000-000000000046}/msip_labels/0x0000001F") as string;
在 属性 名称之后,我必须传递类型描述符 0x0000001F