GetViewGUID and GetListXML

May 31, 2011 at 9:57 PM

I recently started using SharePoint (and SPServices) and realized it can be very powerful. I, however, detest the format Microsoft uses to display the lists/views. So, I wrote a few scripts that return list data in an XML format for you to do whatever you want with. I am using the data to generate my own sortable/filterable table (using a jQuery plugin).

GetViewGUID: returns the GUID for a view

  • webURL: optional
  • listName: required
  • viewDisplayName: the display name of the view

GetListViews: returns all the lists for a view with the display name and GUID and which one is default

  • webURL: optional
  • listName: required

GetListXML: returns list header and data in XML file

  • webURL: optional
  • listName: required
  • viewDisplayName: optional, uses default view for list if not provided
  • viewName: GUID, overrides viewDisplayName if provided
  • CAMLViewFields: optional, uses default for view if not provided
  • CAMLRowLimit: optional, uses 0 as default

The XML that is returned looks something like this:

<list>
	<header>
		<column displayName="col one" staticName="col_one" />
		<column displayName="col two" staticName="col_two" />
	</header>
	<data>
		<row>
			<cell name="col one">blah</cell>
			<cell name="col two">blah</cell>
		</row>
		<row>
			<cell name="col one">blah</cell>
			<cell name="col two">blah</cell>
		</row>
	</data>
</list>

I don't know if anyone else would want the code but I can put it here if anyone does.

 

Coordinator
May 31, 2011 at 10:02 PM
imthenachoman:
It seems as though you're just reinventing what SharePoint already does for you. You may not like the way SharePoint displays lists, but if you try to replace all of the list views, you're going to be working very, very, vary hard to satisfy yourself. The Lists Web Service also already returns list data as XML, so it seems you're just putting it through an isomorphism to clean it up for whatever you're doing down the pike.
M.
May 31, 2011 at 10:05 PM

You're probably right sir. I just started using SP so I don't know how to do a lot of what I wanted. But I don't like the XML SP returns, too convoluted for my understanding. For me, this was more a learning opportunity (first time using/learning jQuery).

Coordinator
Jun 1, 2011 at 2:18 AM

As a learning opp, definitely useful. Since it looks like you're converting the XML from where it starts to another XML structure, though, be careful about introducing processing lags.

M.