NEWFIELD Method
Applies to: SharePoint Foundation 2010
Adds a field to a SharePoint list.
Note
This method is deprecated and may not be supported in future releases. Instead, use the following Web service method:UpdateList(String, XmlNode, XmlNode, XmlNode, XmlNode, String) Web service method.
<Method ID="Text">
<SetList Scope="Request">GUID</SetList>
<SetVar Name="Cmd">NEWFIELD</SetVar>
<SetVar Name="FieldXML"><Field Name="fieldname"
MaxLength="Integer" DisplayName="displayname"
Description="text" Type="Text"/></SetVar>
<SetVar Name="AddToDefaultView">[ON|OFF]</SetVar>
<SetVar Name="owshiddenversion">Integer</SetVar>
</Method>
Parameters
Parameter |
Description |
---|---|
ID = "Text" |
Application-specific string. In an HTML editor compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Server 2007, the string provides the sequence number and name of the method. |
Scope = "Request" |
When set to Request, the Scope attribute sets the variable for the scope of the enclosing Method element, unless the variable is changed by another tag. |
Name = "Cmd" |
Must be set to NEWFIELD. |
Name = "FieldXML" |
The XML description of the new field. For the full set of available attributes and values that can be included, see the Field element definition in the reference for Collaborative Application Markup Language Core Schemas. |
Name = "AddToDefaultView" |
A view is a named set of rules describing how the items in a list are displayed. Each list has a default view associated with it. If AddToDefaultView is set to ON, the field is added to the default view; if it is set to OFF, the field is not added to that view. |
Name = "owshiddenversion" |
This is the current version number of the list. The NEWFIELD command only works if Windows SharePoint Services and the client application agree on the version number of the list. This ensures that only one user at a time can modify the list schema. |
Decoded
<Method ID="0,NEWFIELDSample">
<SetList Scope="Request">GUID</SetList>
<SetVar Name="Cmd">NEWFIELD</SetVar>
<SetVar Name="FieldXML"><Field Name="Sample"
MaxLength="255" DisplayName="Sample"
Description="sample description"
Type="Text"/></SetVar>
<SetVar Name="AddToDefaultView">ON</SetVar>
<SetVar Name="owshiddenversion">6</SetVar>
</Method>