A
Afzal
I am trying to add an item in the custom list on the sharepoint site
from an InfoPath form but it is giving me an error:
Message: "Exception of type
Microsoft.SharePoint.SoapServer.SoapServerException was thrown."
Source: "System.Web.Services"
StackTrace: "at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at lists.Lists.UpdateListItems(String listName, XmlNode updates) in
C:\PIB2\Sample\SubmittoList\Web References\lists\Reference.vb:line 205
at SubmittoList.SubmittoList.CreateStatusHistory_Ex(String strTitle,
String strProject, String dtIssueDate, String strIssueStatus) in
C:\PIB2\Sample\SubmittoList\FormCode.vb:line 142"
Code:
Dim resultError As XmlNode
Dim sBatch As String = ""
Dim oListWS As New lists.Lists
Dim ListName As String
oListWS.Credentials =
System.Net.CredentialCache.DefaultCredentials
resultError = oListWS.GetList("Announcements")
sBatch = "<Method ID=""1"" Cmd=""New"">"
sBatch += "<Field Name=""Title"">![CDATA[" + strTitle +
"]]</Field>"
sBatch += "<Field Name=""Project"">![CDATA[" + strProject +
"]]</Field>"
sBatch += "<Field Name=""StatusDate"">![CDATA[" +
dtIssueDate + "]]</Field>"
sBatch += "<Field Name=""Status"">![CDATA[" +
strIssueStatus + "]]</Field>"
sBatch += "</Method>"
Dim xDoc As New System.Xml.XmlDocument
Dim xBatch As System.Xml.XmlElement =
xDoc.CreateElement("Batch")
xBatch.SetAttribute("OnError", "Continue")
xBatch.SetAttribute("ListVersion", "1")
xBatch.SetAttribute("PreCalc", "TRUE")
xBatch.SetAttribute("ViewName",
"15A7D8ED-F094-45F6-9964-CDF0E6DE26D0")
xBatch.InnerXml = sBatch
Try
Dim xReturn As System.Xml.XmlNode =
oListWS.UpdateListItems("", xBatch)
MsgBox(xReturn.OuterXml)
Catch ex As Exception
MsgBox(vbCrLf + "Exception: " + vbCrLf + ex.Message +
ex.StackTrace + ex.Source)
End Try
from an InfoPath form but it is giving me an error:
Message: "Exception of type
Microsoft.SharePoint.SoapServer.SoapServerException was thrown."
Source: "System.Web.Services"
StackTrace: "at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at lists.Lists.UpdateListItems(String listName, XmlNode updates) in
C:\PIB2\Sample\SubmittoList\Web References\lists\Reference.vb:line 205
at SubmittoList.SubmittoList.CreateStatusHistory_Ex(String strTitle,
String strProject, String dtIssueDate, String strIssueStatus) in
C:\PIB2\Sample\SubmittoList\FormCode.vb:line 142"
Code:
Dim resultError As XmlNode
Dim sBatch As String = ""
Dim oListWS As New lists.Lists
Dim ListName As String
oListWS.Credentials =
System.Net.CredentialCache.DefaultCredentials
resultError = oListWS.GetList("Announcements")
sBatch = "<Method ID=""1"" Cmd=""New"">"
sBatch += "<Field Name=""Title"">![CDATA[" + strTitle +
"]]</Field>"
sBatch += "<Field Name=""Project"">![CDATA[" + strProject +
"]]</Field>"
sBatch += "<Field Name=""StatusDate"">![CDATA[" +
dtIssueDate + "]]</Field>"
sBatch += "<Field Name=""Status"">![CDATA[" +
strIssueStatus + "]]</Field>"
sBatch += "</Method>"
Dim xDoc As New System.Xml.XmlDocument
Dim xBatch As System.Xml.XmlElement =
xDoc.CreateElement("Batch")
xBatch.SetAttribute("OnError", "Continue")
xBatch.SetAttribute("ListVersion", "1")
xBatch.SetAttribute("PreCalc", "TRUE")
xBatch.SetAttribute("ViewName",
"15A7D8ED-F094-45F6-9964-CDF0E6DE26D0")
xBatch.InnerXml = sBatch
Try
Dim xReturn As System.Xml.XmlNode =
oListWS.UpdateListItems("", xBatch)
MsgBox(xReturn.OuterXml)
Catch ex As Exception
MsgBox(vbCrLf + "Exception: " + vbCrLf + ex.Message +
ex.StackTrace + ex.Source)
End Try