DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

Accessing a SP List via Lists.asmx WS by using Views

Posted by PANVEGA on March 19, 2008

In this short post I wanna show you why accessing the Lists.asmx Webservice by giving the appropriate View ID as a parameter. In one of my previous posts I gave you a detail view in this SharePoint Webservice.

I wanna demonstare why it is usefull accesing a custom WS view. If you leave the View parameter in your method  null, the service always reference to the default List View. However usually your default View is what the user should see, when he enters the list. When you wanna hide any fields, which are not interesting for the user, but for your Webservice consumtion, you should build a custom backend View extra for your Webservice.

Note. You only receive the values from the View you just accessed. Other columns are not in your WS return value.

You get the View ID for instance from the URL.

private WSList.Lists returnService;

public WSList.Lists getService()
returnService = new WSList.Lists();
returnService.Credentials = System.Net.CredentialCache.DefaultCredentials;
return returnService;
string listName = “{00E59EFF-1B0E-4C89-B1B0-8C01811FB2D0}”;

string viewName = “{19320268-4DD9-4F1A-B958-33752156977D}”;

try { xmlDoc.Load(new XmlNodeReader(this.getService().GetListItems(listName, viewName, null, null, null, null, null)));

Good Luck


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: