Configuring the SPS RSS Generator

All configuration of the SpsRssGen application is done in the web.config file.  In the future, there will be a UI to edit what is truly a large number of options.

SpsRssGen is configured around the sites entry:

      <sites>

            <server>http://collaboration</server>

            <ignoreList>List Template Gallery, Site Template Gallery, Web Part Gallery</ignoreList>

            <feedGenerator>http://collaboration/SpsRssGen</feedGenerator>

            <site id="1">

                  <url>http://collaboration/sites/cms25</url>

            </site>

      …

 

Server

The root path to your server, used as a base for creating links

ignoreList

A list of template names that you do not want to have syndicated automatically.  Inclusion in this list will only prevent them from being displayed in the site list—they can still be read by passing in the list guid

feedGenerator

The path to the feed generator

When configuring the generator, you would add one site entry for each of the SPS sites you want to have syndicated.  Select a unique id (any value will do), and include the full path to the site in the url entry.

The next major section is the templates section.  A template is basically a definition of a particular type of list in SPS, and a mapping of the individual columns in that list to the RSS format (really, to any syndication format—I am working on Atom feeds next):

                  <template BaseType="1" ServerTemplate="101">

                        <description>A template for documents</description>

                        <mappings type="RSS">

                              <map>

                                    <destination>Title</destination>

                                    <formats>

                                          <format>{0}</format>

                                    </formats>

                                    <sources>

                                          <source formatId="0" split="," index="1">@ows_LinkFilename</source>

                                    </sources>

                              </map>

                              <map>

                                    <destination>Link</destination>

                                    <formats>

                                          <format>{0}/{1}</format>

                                    </formats>

                                    <sources>

                                          <source formatId="0">{:Server}</source>

                                          <source formatId="1" dropPound="true">@ows_FileRef</source>

                                    </sources>

                              </map>

                              …

 

template BaseType

The base type value from SPS for a particular list type

description

A user-friendly description of what you want to accomplish with the template.  It is not displayed anywhere in the RSS feed—it will be used if I ever get to a UI editor for configuration

mappings

A collection of all the entries you wish to fill out in an RSS feed.  At the very least you must have Title and Link.

map

An individual mapping from the List data to an RSS field.  There are some rudimentary methods for aggregating source into the destination (e.g. creating a description by concatenating two fields from the list)

destination

The RSS field: Title, Link, Author, PubDate, Description, Categories.  Note: it is case-sensitive, so please use the correct case.

formats

A collection of one or more formats to use.  The generator will automatically select the best match, depending on what data it can retrieve from the list.  For instance:

<formats>

   <format>{0}</format>

   <format>{0} to {1}</format>

</formats>

If the generator can find source {1}, it will use the second format, otherwise it will use the first.  You can use this to get simple conditional behavior when displaying results.  You can include any kind of text punctuated by {x}’s, including HTML (for presenting tables, for instance)—you can also use it to display constant values.

Sources

A collection of one or more sources to use.  The generator will retrieve the requested source from the List (if it is available), and attempt to place it in the most likely format.  There are two special values you can use for source: {:Server}, and {:DisplayUrl}.  {:Server} will retrieve the current base path from the <server> node.  {:Url} performs a special conversion on the List @DefaultViewUrl, creating a URL that allows you to pass an individual item ID for display.  This is typically used when building the “Link” element for an RSS feed.

 

There are two other options that have been added (they are completely optional).  The first, “dropPound” can be used to remove the text up to and including the “#” that SPS puts in some columns.  If you see data coming out with “#” in it, set dropPound=’true’ and the information will be removed.

 

The second, is a combination of “split” and “index”.  For some types of data, SPS merges two separate fields into a single one (most notably, URL’s to off-server resources).  In order to parse this correctly, you can “split” the column (usually, the columns are separated by commas), and then you can select which item from the split list you wish to use (index).  It is zero-based, so in the following example:

@ows_LinkFilename=’http://www.jonathanmalek.com,My Site”, if you wished to pull out “My Site” as the title, you would use:

<source formatId="0" split="," index="1">@ows_LinkFilename</source>

 

Please let me know if you spot a useful conversion for source information, and I will try to add it.

 

You can add as many templates as you would like (there is always a default one, just in case you haven’t defined a template for a particular type of list).  If you come across a type of template that I have not included in the basic set, please let me know, and I will include it in my distribution.  In the basic set, there are some interesting examples: for instance, the inclusion of start and end dates for events.

Please contact me at http://jonathanmalek.com/blog/contact.aspx if you have any questions or issues.