Sonntag, 12. Februar 2012

Update Field mithilfe des Liste-Webservices



private static Lists InitListsService(string url, bool usedefaultCredentials) 
{
  Lists Lists = new Lists(); Lists.Url = url + "/_vti_bin/Lists.asmx";
  Lists.UseDefaultCredentials = usedefaultCredentials; 
  if (usedefaultCredentials) 
  {
    string user = ConfigurationSettings.AppSettings["user"]; 
    string passwd = ConfigurationSettings.AppSettings["passwd"]; 
    string domain =  ConfigurationSettings.AppSettings["domain"]; 
    Lists.Credentials = new System.Net.NetworkCredential(user, passwd, domain);
  } 
  return Lists;
}

XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlNode ndUpdateFields = xmlDoc.CreateNode(XmlNodeType.Element, "Fields", ""); StringBuilder methods = new StringBuilder(); methods.Append(""); methods.Append(");
methods.Append("ShowInDisplayForm='FALSE' "); methods.Append("Type='Number' "); methods.Append("Name='fieldname' "); methods.Append("DisplayName='internalname' "); 
methods.Append("Required='FALSE' "); methods.Append("FromBaseType='TRUE' "); methods.Append("Description=''/>"); methods.Append("");
ndUpdateFields.InnerXml = methods.ToString(); 
XmlNode xReturn = lists.UpdateList("ListName", null, null, ndUpdateFields, null, null);

Keine Kommentare:

Kommentar veröffentlichen