SetNamespace Method (Fields Collection)

SetNamespace Method (Fields Collection)

The SetNamespace method selects the default property set to be used for accessing named properties in the Fields collection.

Syntax

objFieldsColl .SetNamespace ( PropsetID )

objFieldsColl

Required. The Fields collection object.

PropsetID

Required. String. Contains the GUID that uniquely identifies the property set, represented as a string of hexadecimal characters. This becomes the default property set to be used in subsequent named property accesses to a Field object in this Fields collection. An empty string resets the default property set to PS_PUBLIC_STRINGS.

Remarks

Every named property belongs to a property set, each member of which uses the same GUID for the first part of its name. The set of all possible names within a property set is called its name space. The SetNamespace method specifies which property set is to be in effect until changed by another call to this method. The named properties are accessed using the Fields collection's Add method and Item property.

The initial default value for every property set is PS_PUBLIC_STRINGS. To create your own property set for your named properties, supply a unique property set GUID to SetNamespace. This property set then replaces PS_PUBLIC_STRINGS as the default property set for all subsequent named property accesses in this Fields collection. The new default property set is used unless explicitly overridden by an optional PropsetID parameter in a property or method accessing a field.

The property set value is selected only for the current Fields collection; to use the new default property set for other collections, you must call SetNamespace for each collection.

To define a new property set, obtain a string that contains hexadecimal characters representing a unique identifier. You can obtain this identifier by using the Win32® command line utility UUIDGEN or by calling the Win32 function CoCreateGuid.

For more information on named properties and property sets, see the MAPI Programmer's Reference. For more information on UUIDGEN and CoCreateGuid, see "COM and ActiveX Object Services" in the Microsoft Platform SDK documentation.

See Also

Concepts

Fields Collection Object