This documentation is archived and is not being maintained.

_Columns.Add Method

Adds the Column specified by Name to the Columns collection and resets the Table.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

[DispIdAttribute()]
Column Add(
	string Name
)

Parameters

Name
Type: System.String

The name of the property that is being added as a column.

Return Value

Type: Microsoft.Office.Interop.Outlook.Column
A Column object that represents the new column.

Columns.Add adds the specified Column to the end of the Columns collection for the Table, and resets the Table by moving the current row to just before the first row of the Table. If Columns.Add returns an error, it will not change the current row.

Name can be an explicit built-in property name, or a property name referenced by namespace. It must be referenced as the name in the English locale. For more information on referencing properties by namespace, see Referencing Properties by Namespace.

If you are adding a property which is an explicit built-in property in the object model, for example, _ContactItem.FirstName, you must specify Name as the explicit built-in property name in English. For certain types of properties, the format used when adding these properties as columns affects how their values are expressed in the Table. For more information on property value representation in a Table, see Factors Affecting Property Value Representation in the Table and View Classes.

If you are adding a custom property to a Table, referencing the property by the MAPI string namespace, you will have to explicitly append the type of the property to the end of the property reference. For example, to add the custom property MyCustomProperty, which has the type Unicode string, you will have to explicitly append the type 001f to the reference, resulting in: http://schemas.microsoft.com/mapi/string/{HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH}/MyCustomProperty/0x0000001f, where {HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH} represents the namespace GUID.

Certain properties cannot be added to a Table using Columns.Add, including binary properties, computed properties, and HTML or RTF body content. For more information, see Unsupported Properties in a Table Object or Table Filter.

While _Items.SetColumns can be used to facilitate caching certain properties for extremely fast access to those properties of an Items collection, some properties are restricted from SetColumns. Since these restrictions do not apply to Columns.Add, the Table object is a less restrictive alternative than Items.

Show: