
78
CHAPTER 4 Leveraging the SharePoint LiStSWeb Service
After creating the GetCredential() method, you may easily set the web service credentials to the
results of this method. Figure4-6 shows the full class code.
FIGURE46: Using the GetCredential Method
QUERYING LISTS AND LIST ITEMS
The main retrieval processes are querying the web service for available lists and retrieving list items
from a particular list. Although this process is similar to the object model methods, XML-based
objects and coding is required because the web services use serialized XML to communicate and
transfer data.
Modifying the SharePoint Location
When you set up the web service reference, you used a SharePoint location and the web service URL
reference (
_vti_bin/Lists.asmx). If the SharePoint location was the root, the web service works
on items at that location. You may easily programmatically change the location by modifying the
URL setting of the Lists web service object:
listsWS.Url=”http://sproot/sites/sitecollection/subsite/_vti_bin/lists.asmx”
105054c04.indd 78 1/10/12 3:34 PM