I'm have some trouble using the GetList web service. It does work sometimes but not at the start of the day!?!
Here is my code:
public static void ListSurveys(string serverName)
{
EndpointAddress endpoint = new EndpointAddress(serverName + SERVICE_SITEDATA_URL);
SiteDataSoapClient client = new SiteDataSoapClient("SiteDataSoap", endpoint);
_sList[] lists;
uint count = client.GetListCollection(out lists);
foreach (_sList list in lists)
{
if (list.BaseType == "Survey")
{
System.Console.WriteLine(list.Title + ", " + list.InternalName);
_sListMetadata meta;
_sProperty[] props;
uint glc = client.GetList(list.InternalName, out meta, out props);
System.Console.WriteLine(meta.Title);
}
}
}
As you can see, I fetch all the lists using GetListCollection and then, if it is a survey, I try to get the List information using GetList. I use the List GUID as the list name. An exception is thrown. The SOAP body is shown below.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Eine Ausnahme vom Typ Microsoft.SharePoint.SoapServer.SoapServerException wurde ausgelöst.</faultstring>
<detail>
<errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">
Die Liste ist nicht vorhanden.
Die ausgewählte Seite enthält eine Liste, die nicht vorhanden ist. Die Liste könnte von einem anderen Benutzer gelöscht worden sein.
</errorstring>
<errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/">0x82000006</errorcode>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The error message says that the list was not found and might have been deleted by someone else. This is strange because my code had fetched the GUID of the list just milliseconds earlier!
Can anyone explain what is going on here? I had the same problem yesterday and at some point it just went away. Unfortunately it came back this morning.
UPDATE As I was writing the question I had an idea. I visited the survey overview page and tried the webservice again. It worked!! Going to the list of surveys page was not enough - I had to go to the overview page itself. Seems the lists need to be 'woken up' each morning. Is this a bug?