Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/923902

From BetaArchive Wiki
Knowledge Base

Values that were previously associated with a field are reset when you run a custom code that calls the Lists.UpdateList method to update a list view in SharePoint Products and Technologies

Article ID: 923902

Article Last Modified on 5/14/2007


  • Microsoft Office SharePoint Server 2007
  • Microsoft Office SharePoint Portal Server 2003
  • Microsoft Windows SharePoint Services 3.0
  • Microsoft Windows SharePoint Services


Consider the following scenario. In one of the products that are listed in the "Applies to" section, you create a custom code that references the List.asmx Web service. The code calls the Lists.UpdateList method and adds a field to a list view. The code then updates a property of the field. For example, the code updates the display name of the field. However, when you run the code, the property of the field is not updated as expected. Instead, all the values that were previously associated with the field are reset.

The following code is an example of a code in which you experience these symptoms:

// Initialisation - BEGINS
PostLists.Lists lst = new TESTBED.PostLists.Lists();
lst.Credentials = System.Net.CredentialCache.DefaultCredentials;

XmlNode ndList = lst.GetList("ListName");
XmlNode ndVersion = ndList.Attributes["Version"];

XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlNode ndProperties = xmlDoc.CreateNode(XmlNodeType.Element, "List", "");

XmlNode ndDeleteFields = xmlDoc.CreateNode(XmlNodeType.Element,"Fields","");
XmlNode ndNewFields = xmlDoc.CreateNode(XmlNodeType.Element,"Fields","");
XmlNode ndUpdateFields = xmlDoc.CreateNode(XmlNodeType.Element,"Fields","");

XmlAttribute ndTitleAttribute = (XmlAttribute)xmldoc.CreateNode(XmlNodeType.Attribute, "Title", "");
XmlAttribute ndDescriptionAttribute = (XmlAttribute)xmldoc.CreateNode(XmlNodeType.Attribute, "Description", "");



// Initialisation - ENDS

// STEP1: Add a new Field
ndNewFields.InnerXml = "<Method ID='1'>" +
                                                     "<Field Type='DateTime' Name='testNewField1' DisplayName='testNewField1 description'>" +
                                             " </Method>";

// STEP1.1: Call the Lists.UpdateList method
XmlNode ndReturn =
                       ndProperties, ndNewFields, null , null,


// STEP2: Update that field
 ndUpdateFields.InnerXml = "<Method ID='2'>" +
                    "<Field Type='DateTime' Name='testNewField1' DisplayName='Field1'/>" +

// STEP2.1: Call the Lists.UpdateList method
XmlNode ndReturn =
                       ndProperties, null, ndUpdateFields , null,



This problem occurs because the Lists.asmx Web service assigns null values to all values that are not explicitly passed in the update operation.


To work around this problem, use the Lists.asmx Web service to update the property of the field. To do this, note the original values of the field. Then, when you update the field, pass the original values in addition to the updated values.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


For more information about the Lists.UpdateList method, visit the following Microsoft Web site:

Additional query words: wssv3 wss

Keywords: kbprb kbtshoot kbexpertiseinter KB923902