AddFieldAsXml Method (String, Boolean, SPAddFieldOptions)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

SPFieldCollection.AddFieldAsXml Method (String, Boolean, SPAddFieldOptions)

Windows SharePoint Services 3

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

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

public string AddFieldAsXml(
	string schemaXml,
	bool addToDefaultView,
	SPAddFieldOptions op


Type: System.String
A Collaborative Application Markup Language (CAML) string that contains the schema.
Type: System.Boolean
true if field is added to the default list view; otherwise, false.
Type: Microsoft.SharePoint.SPAddFieldOptions
An SPAddFieldOptions value that specifies the field options.

Return Value

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