This documentation is archived and is not being maintained.

SPFieldCollection.Add Method (String, SPFieldType, Boolean, Boolean, StringCollection)

Windows SharePoint Services 3

Creates a field in the collection based on the specified display name, field type, Boolean values for other field properties, and choices in the case of a Choice field.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Public Function Add ( _
	strDisplayName As String, _
	type As SPFieldType, _
	bRequired As Boolean, _
	bCompactName As Boolean, _
	choices As StringCollection _
) As String
Dim instance As SPFieldCollection
Dim strDisplayName As String
Dim type As SPFieldType
Dim bRequired As Boolean
Dim bCompactName As Boolean
Dim choices As StringCollection
Dim returnValue As String

returnValue = instance.Add(strDisplayName, _
	type, bRequired, bCompactName, choices)


Type: System.String
A string that specifies the display name of the field.
Type: Microsoft.SharePoint.SPFieldType
A SPFieldType value that specifies the type of field to create.
Type: System.Boolean
true to require that the field contain a value; otherwise, false.
Type: System.Boolean
true to compact the field name to eight characters; otherwise, false.
Type: System.Collections.Specialized.StringCollection
A System.Collections.Specialized.StringCollection object that contains choices for a Choice field.

Return Value

Type: System.String
A string that contains the name of the new field.