Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Problem using List web service of Sharepoint

  Asked By: Juan    Date: Feb 23    Category: Sharepoint    Views: 1741

I'm working on Document Library using the Lists web service. I am
getting the Microsoft.SharePoint.SoapServer.SoapServerException
exception on using the methods(specifically GetListItems method) of
this web service. I have tried using both the Default Credentials and
the Network Credentials where I pass on my id(my username has admin
rights on Sharepoint).

However I get the same above mentioned exception.

Any pointers to the above will be very helpful.



2 Answers Found

Answer #1    Answered By: Sammie Lancaster     Answered On: Feb 23

Without seeing your exact code it's difficult to tell. I've used code like that
shown below, which seems to work reliably. But to be honest, I've come to
prefer using the object model because the it's more programmer-friendly and less

Private Sub ProcessDoclib(ByVal BaseUrl As String, ByVal ListName As String)

Dim listService As New localhost.Lists

listService.Url = strBaseUrl & "/" & _vti_bin/lists.asmx"

listService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim xmlDoc = New System.Xml.XmlDocument

Dim ndQuery As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "")

Dim ndViewFields As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element,
"ViewFields", "")

Dim ndQueryOptions As XmlNode = xmlDoc.CreateNode(XmlNodeType.Element,
"QueryOptions", "")


Dim ndListItems As XmlNode = listService.GetListItems(strListName, Nothing,
ndQuery, _

ndViewFields, Nothing, ndQueryOptions)

Dim ds As New DataSet

Dim sr As New System.IO.StringReader(ndListItems.OuterXml)


' Do whatever needs to be done...

Catch ex As System.Web.Services.Protocols.SoapException

Response.Write("Message:" + ControlChars.Lf + ex.Message + ControlChars.Lf + _

"Detail:" + ControlChars.Lf + ex.Detail.InnerText + ControlChars.Lf + _

"StackTrace:" + ControlChars.Lf + ex.StackTrace)

End Try

End Sub

Answer #2    Answered By: Aron Kirk     Answered On: Feb 23

One more inforamation regarding the error message i get, after the call to the
method of the webservice, my portal goes down though the site is still working.

On browsing to the Portal it gives a error message as:

You cannot view this area, either because the area no longer exists, or because
you do not have the rights to view this area. To change your rights, contact the
site administrator.

The snippet of the code where we are doing this is :

NetworkCredential credential= new
NetworkCredential("neha_singh02","great@2303","ITLINFOSYS"); // This is passed
to consume the webService, Search.asmx

listService.Credentials= credential;



//Code to get ID of the file from the document  Library

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode syQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");

XmlNode syViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");

XmlNode syQueryOpt = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");

//Build Queries

syViewFields.InnerXml = "<FieldRef Name='ID' /><FieldRef Name='Title'/>";

syQueryOpt.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>"


strXml= strXml+ "<Where><Eq><FieldRef Name='FileRef'/>" +

"<Value Type='Text'>" + fileUrl +"</Value></Eq></Where>";

syQuery.InnerXml =strXml;

//Get details from using the web  service

System.Xml.XmlNode ndListItems = listService.GetListItems("Restricted Access",
null, syQuery,

Didn't find what you were looking for? Find more on Problem using List web service of Sharepoint Or get search suggestion and latest updates.