Geeks With Blogs

Lance's TextBox

It took me a while to figure out how to get a list of all the available fields for a particular type of list in SharePoint (for performing custom queries in SPQuery).  I was looking for a published list of these fields, which as far as I know does not exist.  Instead, you just use the GetList method of the Lists SOAP service.  Here’s an example SOAP request:

<?xml version="1.0" encoding="utf-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" SOAP-ENV:encodingStyle=""> 
    <GetList xmlns=""> 
      <listName>Private Documents</listName> 

Just specify the name of the list you want the fields for as the value for the listName input element.

One easy way to work with SharePoint services remotely is by using /n software’s SharePoint Integrator developer toolkit.  Using its SPSite component in Visual Studio I can whip together a few lines of code to consume get the results from the aforementioned service:

spsite1.URL = "http://mysharepoint/mysite/";
spsite1.User = "DOMAIN\lancer";  
spsite1.Password = "password";  
spsite1.DescribeList("Private SharePoint Documents");; 

/n software SharePoint Integrator highlights:

    • Read, Write, and Create SharePoint Lists Items, Documents, and Attachments.
    • Programmatic control of SharePoint Sites, capabilities, and configuration
    • 128-bit strong SSL encryption keeps sensitive transaction information confidential.
    • Small and lightweight components with no dependencies on external libraries.
    • Native development components for all supported platforms and component technologies.
    • Unlimited free Email technical support backed by an experienced & professional staff.
    • Compatible with Microsoft Office SharePoint Server (MOSS), and Windows SharePoint Services v3.0 + (WSS).


Technorati Tags: ,
Posted on Monday, December 7, 2009 4:24 AM Programming | Back to top

Comments on this post: Listing SPQuery FieldNameRefs

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Lance Robinson | Powered by: