SPFieldCollection.AddFieldAsXml Method (String, Boolean, SPAddFieldOptions)

Creates a field based on the specified schema, Boolean value, and field options.

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

Syntax

'Declaration
Public Function AddFieldAsXml ( _
    schemaXml As String, _
    addToDefaultView As Boolean, _
    op As SPAddFieldOptions _
) As String
'Usage
Dim instance As SPFieldCollection
Dim schemaXml As String
Dim addToDefaultView As Boolean
Dim op As SPAddFieldOptions
Dim returnValue As String

returnValue = instance.AddFieldAsXml(schemaXml, _
    addToDefaultView, op)
public string AddFieldAsXml(
    string schemaXml,
    bool addToDefaultView,
    SPAddFieldOptions op
)

Parameters

  • addToDefaultView
    Type: System.Boolean

    true if field is added to the default list view; otherwise, false.

Return Value

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

See Also

Reference

SPFieldCollection Class

SPFieldCollection Members

AddFieldAsXml Overload

Microsoft.SharePoint Namespace