AddFieldAsXml Method

The AddFieldAsXml method of the SPFieldCollection class creates a field based on the specified schema.

Parameters

strXml   A string in Collaborative Application Markup Language (CAML) that contains the schema.

Return Value

A string in CAML that contains the name of the new field.

Example

The following code example uses CAML to define a field and adds the field to the specified list.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security