使用MsgKit创建MSG - 如何使用AddProperty方法?

问题描述 投票:0回答:1

我正在使用这个工具 https://github.com/Sicos1977/MsgKit 创建 MSG 文件,然后使用 Outlook 显示并发送它。

我需要添加属性“BillingInformation”,以便发送后,OutlookAddin 能够处理信息。

我知道,有一个方法“AddProperty” - 但我无法正确执行此操作。

有人可以帮助我吗?谢谢!

        using (var email = new Email( 
            new Sender(SenderTextBox.Text, string.Empty),
            SubjectTextBox.Text, 
            DraftMessageCheckBox.Checked,
            ReadReceiptCheckBox.Checked)) 
        {
            email.Recipients.AddTo(ToTextBox.Text);
            email.Subject = SubjectTextBox.Text;
            email.BodyText = TextBodyTextBox.Text;
            email.Attachments.Add("Images\\peterpan.jpg");

            email.AddProperty(??????, "abcd");
  
            email.Save("c:\\temp\\email.msg");
                     }
  
        System.Diagnostics.Process.Start("c:\\temp\\email.msg");
outlook mapi msg
1个回答
0
投票

我没有使用MsgKit,但是看它的源码,你需要的是类似下面的东西

var billingPropTag = new NamedPropertyTag(0x8535, "Billing", 
                          new Guid("00062008-0000-0000-C000-000000000046"),
                          PropertyType.UNICODE)
email.AddProperty(billingPropTag , "abcd");

如果您单击 IMessage 按钮或通过单击 OpenIMsgOnIStg 打开 MSG 文件,您可以使用 OutlookSpy(我是其作者)查看属性标签(已命名和固定)及其标签、GUID 和 id:

© www.soinside.com 2019 - 2024. All rights reserved.