recently, i change my sharepoint 2010 to claim based authentication. and almost all of my code calling webservice show me errors.
with some edit, the select method seems ok, but the method to insert still shows errors. below is the code.
protected void Button1_Click(object sender, EventArgs e) { Authentication authSvc = new Authentication(); authSvc.Url = "http://moss/_vti_bin/authentication.asmx"; authSvc.CookieContainer = new System.Net.CookieContainer(); LoginResult result = authSvc.Login("domainAdmin", "domainPwd"); newoa.Lists listInstance = new newoa.Lists(); listInstance.Url = "http://moss/_vti_bin/Lists.asmx"; CookieCollection cookies = authSvc.CookieContainer.GetCookies(new Uri(authSvc.Url)); Cookie cookie = cookies[result.CookieName]; listInstance.CookieContainer = new CookieContainer(); if (cookie != null) listInstance.CookieContainer.Add(cookie); XmlDocument xmlDocument = new XmlDocument(); XmlElement updatesNode = xmlDocument.CreateElement("Batch"); XmlElement methodNode = xmlDocument.CreateElement("Method"); methodNode.SetAttribute("ID", "0"); methodNode.SetAttribute("Cmd", "New"); updatesNode.AppendChild(methodNode); XmlElement titleNode = xmlDocument.CreateElement("Field"); titleNode.SetAttribute("Name", "Title"); titleNode.InnerText = tName.Text; ; methodNode.AppendChild(titleNode); XmlElement bodyNode = xmlDocument.CreateElement("Field"); bodyNode.SetAttribute("Name", "Body"); bodyNode.InnerText = tContent.Text; methodNode.AppendChild(bodyNode); XmlNode resultNode = listInstance.UpdateListItems("list name", updatesNode); LabelMsg.Text = resultNode.InnerXml; }
could some one please help me! thanks a lot!
lixw