Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 11th, 2008, 06:30 PM
Authorized User
Join Date: Oct 2003
Location: Golden, CO, USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sharepoint GetListItems() ViewFields not working

Hi Everyone - not sure if this is the right forum - maybe someone can point me in the right direction.

I'm following what I think should work and narrow down my results from the GetListItems() method of Sharepoint 2007.

I'm creating an XML element <ViewFields> and populating it with <FieldRef Name="NewsTitle" /><FieldRef Name="ID" /></ViewFields> and passing it in to the ViewFields argument. But the web service returns *all* fields, no matter what view name I give it (null or the guid).

Any ideas what's going on?

Code posted below

string strReturn = string.Empty;
            vsharepoint2007.Lists L = new WSTest.vsharepoint2007.Lists();
            L.Url = "http://vsharepoint2007:16848/_vti_bin/lists.asmx";
            L.Credentials = new System.Net.NetworkCredential("administrator", "forkhead");
            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            string listName = "{A36E3C89-F137-4205-8699-3476D58D82CC}";
            string viewName = "{93B7AAB7-7BCB-4CB4-BCE7-7BA384165698}";
            string rowLimit = "1";
            System.Xml.XmlElement ndQuery = xmlDoc.CreateElement("Query");
            System.Xml.XmlElement ndViewFields = xmlDoc.CreateElement("ViewFields");
            System.Xml.XmlElement ndQueryOptions = xmlDoc.CreateElement("QueryOptions");

            ndQuery.InnerXml = "<Where><Eq><FieldRef Name=\"ID\" />" +
                    "<Value Type=\"Counter\">1</Value>" +
            ndViewFields.InnerXml = "<FieldRef Name=\"NewsTitle\" /><FieldRef Name=\"ID\" />";
            ndQueryOptions.InnerXml = "";
            System.Xml.XmlNode nodeListItems = L.GetListItems(listName, null, ndQuery, ndViewFields, rowLimit, ndQueryOptions, null);

            foreach (System.Xml.XmlNode X in nodeListItems)
                strReturn += X.OuterXml;
            return strReturn;

"A spirit with a vision is a dream with a mission"
\"A spirit with a vision is a dream with a mission\"
Reply With Quote
  #2 (permalink)  
Old August 12th, 2008, 03:16 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

I think a Sharepoint forum would be better for this question:


However by a simple reading of the docs I could guess that it might have something to do with the IncludeMandatoryColumns value defaulting to TRUE.


/- Sam Judson : Wrox Technical Editor -/
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharepoint ramamurthi_c SharePoint Development 1 December 11th, 2009 07:01 PM
Sharepoint Jayarajmrj SQL Server 2000 1 July 30th, 2007 10:16 PM
Sharepoint Search x_ray SharePoint Admin 0 December 2nd, 2006 12:33 PM
Sharepoint Chart, nlpatel78 ASP.NET 2.0 Basics 0 July 28th, 2006 01:18 AM
Local COM working , but not working at Web Serv nagen111 .NET Web Services 3 February 19th, 2005 04:22 AM

All times are GMT -4. The time now is 04:44 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.