I'm trying to learn to call SharePoint Web Services from an external C# client. I'm using MOSS 2007 and VS 2008. There are lots of examples on the web of doing so, but most of them seem to be using a different form of each of the Web Service APIs than what I'm seeing in Visual Studio. My question is...what up wit dat?
When, for example, I launch Visual Studio 2008, create a new C# Console Application project, and then do a "Add Service Reference..." to add a reference to "http://myspserver/_vti_bin/Lists.asmx", the resulting namespace (with whatever name I chose to give it) contains the classes ListsSoap, ListsSoapChannel, and ListsSoapClient but no Lists class.
But many of the examples I see expect there to be a Lists class in that namespace. I keep seeing code like this:
sharepoint.lists.Lists l = new sharepoint.lists.Lists();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential("your username here", "your password here");
l.Credentials = cred;
XmlNode n = l.GetListItems("your calendar name here", null, null, null, null, null, null);
This code doesn't compile for me. I wouldn't expect it to as browsing the binding to the Lists service ("sharepoint.lists" in this case) shows me these other classes I mention above but no Lists class.
And it doesn't work to replace the use of Lists() with one of the other classes, like ListsClient(). If I do that, I have problems later on. For example, the ListsClient object has no "Credentials" property, but rather a "ClientCredentials" property.
It's almost as if I'm using an older or newer form of the APIs, but I'm using MOSS 2007 (WSS 3.0) and the examples I'm seeing say they're written against the same SP versions.
What am I missing or doing wrong here? Where does this Lists class come from?
Humble TIA for any help.
PS: The code above comes from here: http://geekswithblogs.net/mcassell/archive/2007/08/22/Accessing-Sharepoint-Data-through-Web-Services.aspx