简体   繁体   English

Office 2007/2010 VSTO添加列

[英]office 2007/2010 VSTO add column

How do I go about adding a column (Custom Property) to all the messages in outlook. 如何将一列(自定义属性)添加到Outlook中的所有消息。 I wish to add a custom property to each email message. 我希望为每个电子邮件添加一个自定义属性。 I need to allow the user to switch the property on and off. 我需要允许用户打开和关闭属性。

I have created a new add-in but cannot find a sample or similar functionality anywhere. 我创建了一个新的加载项,但是在任何地方都找不到示例或类似功能。

If I can understand how to add the property and display it in outlook the rest I can figure out for myself. 如果我能理解如何添加该属性并将其显示在Outlook中,其余的我可以自己解决。

As far as I know there are two ways to do this. 据我所知,有两种方法可以做到这一点。 First is by a folder. 首先是通过文件夹。

var calendar = _session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
var userProperties = calendar.UserDefinedProperties;
var prop = userProperties.Find("PropName");
{
    if (prop  == null)
        userProperties.Resource.Add("PropName", OlUserPropertyType.olText);
}

Or by adding to the UserProperties of a mail item, and set the flag to add it to the folder. 或通过添加到邮件项目的UserProperties,并设置标志以将其添加到文件夹中。 I don't know how to add a property to a type of item, but hopefully this will point you in the right direction. 我不知道如何将属性添加到一种类型的项目,但希望这会为您指明正确的方向。

See http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.userproperties.add.aspx 请参阅http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.userproperties.add.aspx

Cheers, Jake 干杯,杰克

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM