Displaying Scheduled and Approved content from a List

I have been looking at how I can provide a simple way for the owner of a site to schedule the appearance and expiration of content on one or more pages in a SharePoint site using a list as the source. Sounds simple but in this case the owner also wants to be able to place a content approval process in place as well.

To address the requirements I have created a list that contains the following columns

  • a basic Title field as a description of the content;
  • a Content field that is defined as Multiple Lines of content with Enhanced Rich Text support;
  • the standard site column Start Date (date and time); and
  • the standard site column End Date (date and time).

On top of the basic list definition I added following two views:

  1. The first view to display the Content field when the current date is >= Start Date AND current date <= End Date
  2. The second view to display the Content field using the same criteria as view 1 AND also only if the content has been Approved.

These two views provide some flexibility around the display of the content and additional ones can be defined to support addiitonal functionality that may be required such as targeting of content via audiences or in different locations in the site etc.

The issues I hit with this approach are that the filtering mechanism in 2007 doesn’t allow the inclusion of a time value in the filter criteria, only date via the [Today] parameter, and the only way I can see of getting around this is to build a custom web part that does this either in code or via XSLT transformation.

The second issue arose when I attempted to filter a view based on the Approval Workflow status. The status displays as In Progress, Approved etc but if you use these as the matching criteria no records are displayed. After some investigation it turns out that internally the status is stored as an integer (obviously a lookup for the full status text). Here are the values you need if you want to perform a filter on the workflow status:

  • Not Started = 0
  • Failed on Start = 1
  • In Progress = 2
  • Error Occurred = 3
  • Stopped By User = 4
  • Completed = 5
  • Failed on Start Retrying = 6
  • Error Occurred Retrying = 7
  • Cancelled = 15
  • Approved = 16
  • Cancelled = 17

Leave a comment

Filed under Microsoft Office Sharepoint Server 2007

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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