Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Write to SharePoint 2007 list using Web Services, getting Soap error

$
0
0
Hello! I have never worked with XML or SharePoint's Web Services but am not facing a need to use it. I am attempting to write to my SharePoint 2007 list with the following code and am getting the following error :

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

Here is my code I copied from Phil on StackOverflow

Dim lists As New BofaListWebReference.Lists() lists.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim listguid As String = "{my list guid}"

'Get Name attribute values (GUIDs) for list and view.

Dim ndListView As System.Xml.XmlNode = lists.GetListAndView(listguid, "")

Dim strListID As String = ndListView.ChildNodes(0).Attributes("Name").Value

Dim strViewID As String = ndListView.ChildNodes(1).Attributes("Name").Value

'Create an XmlDocument object and construct a Batch element and its 'attributes. Empty string as view means use the default view.

Dim doc As New System.Xml.XmlDocument()

Dim batchElement As System.Xml.XmlElement = doc.CreateElement("Batch") batchElement.SetAttribute("OnError", "Continue") batchElement.SetAttribute("ListVersion", "1") batchElement.SetAttribute("ViewName", strViewID)

batchElement.InnerXml = "<Method ID='1' Cmd='New'>" + "<Field Name='Title'>test</Field>" Try

lists.UpdateListItems(strListID, batchElement) Label1.Text = "Call Escalated to sharepoint, ok." Catch ex As Exception

Label1.Text = ex.ToString

End Try

Sorry, the pasting of the code didn't work as expected.

Any help on getting me the ability to write to my list will be greatly appreciated.

Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>