Share via


ListFieldInteger Object

SharePoint Designer Developer Reference

Contains information about fields that the computer creates automatically.

Remarks

The ListFieldinteger object cannot be created by the user; Office SharePoint Designer uses it to create an ID for each item in the list. For example, in a typical list, the ID field is created by the computer as a unique identifier for each item in the list. Use ListFields(Index) to return a ListFieldInteger object, where Index is either the name of the field or its numeric position within the collection. The following example displays the names of all Integer fields in the first list. If the Web site contains no lists, or if the list contains no Integer fields, a message is displayed to the user.

Visual Basic for Applications
Sub ListIntegerFields()
'Displays the name of Integer fields in the current list
    Dim objApp As Application
    Dim objField As ListField
    Dim strType As String
    Dim blnFound As Boolean
    blnFound = False
    Set objApp = Application
    If Not ActiveWeb.Lists Is Nothing Then
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            'Check if it is a computed field of type FieldTypeInteger
            If objField.Type = FieldTypeInteger Then
                blnFound = True
                If strType = "" Then
                    'Create new string
                    strType = objField.Name & vbCr
                Else
                    'Add next field name to string
                    strType = strType & objField.Name & vbCr
                End If
            End If
        Next objField
        If blnFound = True Then
            MsgBox "The names of the fields in this list are: " & _
                    vbCr & strType
        Else
            MsgBox "There are no Integer fields in the list."
        End If
    Else
        'Otherwise display message to user
        MsgBox "The current Web site contains no lists."
    End If
End Sub

See Also