tags:

views:

8

answers:

1

Hi,

How do I go about adding a column (Custom Property) to all the messages in 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.

Thanks

Regards

Craig.

A: 

Hi Craig

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. 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

Cheers, Jake

Jake Ginnivan