NEWFIELD Method

Adds a field to a SharePoint list.

Syntax

<Method ID="Text">
  <SetList Scope="Request">GUID</SetList>
  <SetVar Name="Cmd">NEWFIELD</SetVar>
  <SetVar Name="FieldXML">&lt;Field Name=&quot;fieldname&quot;
    MaxLength=&quot;Integer&quot; DisplayName=&quot;displayname&quot;
    Description=&quot;text&quot; Type=&quot;Text&quot;/&gt;</SetVar>
  <SetVar Name="AddToDefaultView">[ON|OFF]</SetVar>
  <SetVar Name="owshiddenversion">Integer</SetVar>
</Method>

Parameters

ID = "Text"

Scope = "Request"

Name = "Cmd"

Name = "FieldXML"

Name = "AddToDefaultView"

Name = "owshiddenversion"

Decoded

<Method ID="0,NEWFIELDSample">
  <SetList Scope="Request">GUID</SetList>
  <SetVar Name="Cmd">NEWFIELD</SetVar>
  <SetVar Name="FieldXML">&lt;Field Name=&quot;Sample&quot;
    MaxLength=&quot;255&quot; DisplayName=&quot;Sample&quot;
    Description=&quot;sample description&quot; Type=&quot;Text&quot;/&gt;</SetVar>
  <SetVar Name="AddToDefaultView">ON</SetVar>
  <SetVar Name="owshiddenversion">6</SetVar>
</Method>

Return Value

Success

Returns the code attribute, which is a signed-decimal representation of an HRESULT.

Error

Returns an XML-encoded Unicode (UTF-8) text string. See Error Message Format for Windows SharePoint Services for more information.

Sample Output