How to catch a Microsoft.SharePoint.SoapServer.SoapServerException?
Posted
by JL
on Stack Overflow
See other posts from Stack Overflow
or by JL
Published on 2010-06-02T18:13:48Z
Indexed on
2010/06/02
18:23 UTC
Read the original article
Hit count: 781
I am a bit perplexed on how to catch a specific error type of Microsoft.SharePoint.SoapServer.SoapServerException, I'll explain why, and I've included a code sample below for you guys to see.
As you know there are 2 ways to interact with MOSS.
- The object model (only runs on MOSS Server)
- Web Services (can be run on a remote machine querying the MOSS server)
So as per code sample I'm using web services to query MOSS, because of this I don't have sharepoint installed on the remote server running these web services and without MOSS installed its impossible to reference the SharePoint DLL to get the specific error type : Microsoft.SharePoint.SoapServer.SoapServerException.
If I can't reference the DLL then how the heck am I supposed to catch this specific error type?
System.Xml.XmlNode ndListView = wsLists.GetListAndView(ListName, "");
string strListID = ndListView.ChildNodes[0].Attributes["Name"].Value;
string strViewID = ndListView.ChildNodes[1].Attributes["Name"].Value;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement batchElement = doc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
batchElement.SetAttribute("ViewName", strViewID);
batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +
"<Field Name='DeliveryStatus'>" + newStatus.ToString() + "</Field>" +
"<Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + id + "</Value></Eq></Where></Method>";
try
{
wsLists.UpdateListItems(strListID, batchElement);
return true;
}
catch (Microsoft.SharePoint.SoapServer.SoapServerException ex)
{
}
© Stack Overflow or respective owner