共用方式為


SPFieldCollection.CreateNewField Method

Creates a field based on the specified type name and display name.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Function CreateNewField ( _
    typeName As String, _
    displayName As String _
) As SPField
'Usage
Dim instance As SPFieldCollection
Dim typeName As String
Dim displayName As String
Dim returnValue As SPField

returnValue = instance.CreateNewField(typeName, _
    displayName)
public SPField CreateNewField(
    string typeName,
    string displayName
)

Parameters

  • typeName
    Type: System.String

    A string that contains the internal name of the type of the field.

  • displayName
    Type: System.String

    A string that contains the display name.

Return Value

Type: Microsoft.SharePoint.SPField
An SPField object that represents the new field.

Remarks

typeName identifies the type of the new field. It must use the internal name of the field type. Internal names must not contain spaces or punctuation marks. Examples are "Author", "BusinessData", and "SocialSecurityNumber".

See Also

Reference

SPFieldCollection Class

SPFieldCollection Members

Microsoft.SharePoint Namespace