Name Property (Field Object)

The Name property returns the name of the field as a string. Read-only.

Syntax

objField.Name

objField.Name(PropsetID)

objField
Object. The Field object.
PropsetID
Optional. String. Contains the GUID that identifies the property set, represented as a string of hexadecimal characters. When this identifier is not present, the property is created within the default property set. The default property set is either the property set most recently supplied to the SetNamespace method, or the initial default property set value, PS_PUBLIC_STRINGS.

Data Type

String

Remarks

The Name property is read-only. You set the name of the Field object at the time you create it, when you call the Fields collection's Add method.

The length of the name of a custom property is limited to 120 characters. An attempt to exceed this limit returns an error. Note that this limitation does not apply to the value of the property.

Field objects used to access predefined MAPI properties do not have names. Names appear only on the custom properties that you create. For more information, see the Item property documentation for the Fields collection.

Example

' fragment from Fields_Add 
Dim objNewField As Object ' new Field object 
    Set objNewField = objFieldsColl.Add( _ 
                      Name:="Keyword", _ 
                      Class:=vbString, _ 
                      Value:="Peru") 
    If objNewField Is Nothing Then 
        MsgBox "could not create new Field object" 
        Exit Function 
    End If 
    cFields = objFieldsColl.Count 
    MsgBox "new Fields collection count = " & cFields 
' later: fragment from Field_Name; modified to use objNewField 
    If "" = objNewField.Name Then 
        MsgBox "Field has no name; ID = " & objNewField.ID 
    Else 
        MsgBox "Field name = " & objNewField.Name 
    End If