public void UpdateSharePointListFromXML() { string filename = Server.MapPath("XMLFile1.xml"); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(filename); XmlNodeList topM = xmldoc.DocumentElement.ChildNodes; foreach (XmlElement element in topM) { if (element.Name == "ISA_Info") { Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(delegate() { SPSite site = new SPSite("http://jack-7716f30e37:2012"); using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; site.AllowUnsafeUpdates = true; SPList list = web.Lists["MyList"]; SPListItem Item = list.Items.Add(); Item["field"] = element.Attributes[0].Value.ToString(); Item["Value"] = element.Attributes[1].Value.ToString(); Item.Update(); list.Update(); } }); } } }