Sharepoint listsService.updateList method clarification

Posted by cyrix86 on Stack Overflow See other posts from Stack Overflow or by cyrix86
Published on 2010-04-22T20:51:06Z Indexed on 2010/04/22 20:53 UTC
Read the original article Hit count: 539

Filed under:
|

I've seen an example here: msdn but it's a little confusing.

So if I have a list definition with a field called "CustomField" and I want to update the "ShowField" attribute of this field to be true then I would do this:

XmlNode listNode = listService.GetList("MyList");
string version   = listNode.Attributes["Version"].Value;
string guid      = listNode.Attributes["Name"].Value;

XmlDocument xmlDoc = new XmlDocument();
XmlElement updateFields = xmlDoc.CreateElement("Fields");

string fieldXml = @"<Method ID="1"><Field Name="CustomField" ShowField="true" /></Method>";

updateFields.InnerXml = fieldXml;

XmlNode result = listService.UpdateList(guid, null, null, updateFields, null, version);

I'm confused because it would seem that you would need to provide a field element to indicate what field to update and then a value element to specify the new value.

Could someone clarify this please?

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about webservice