Gradients in CSS Branding of SharePoint Sites

Many of the gradients that you see in the default SharePoint branding (that dreaded blue and orange that everyone wants to change) are created by using an image that is the appropriate height and one pixel wide.  The images are used as the background-image in the various CSS classes with background-repeat set to repeat-x.  This is nice because the image will be repeated horizontally for as many pixels as are required, regardless of the width of the object.
If you can reasonably rely on your users having some flavor if Internet Explorer (Some of these tricks may work just fine in other browsers, but I haven’t done any testing other than with IE.), there are some nice tricks outlined in this article:
Instead of using images to create your gradients, you can use DXImageTransform.Microsoft.gradient in your CSS in a filter, like this:
.my-css-class {
  filter: progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#596E9E, endColorstr=#000000);
What this does is to dynamically create the gradient, going from the start color to the end color over as many pixels as there are in your object.  This means that you don’t have to worry about the size of objects ahead of time; the filter will adjust as needed.
I would still recommend setting a background color (as above) to handle the cases where the filter may not display correctly.  I have run into some areas in the default master page where this is the case, but I haven’t been able to isolate the exact reason.  I suspect it may be caused by some of the scripts that run on various controls.

“Failed to load the workflow” Message in SharePoint Designer

I’m working at a new client and just getting the machine that they have me using working the way I like it.  I tried to open a workflow in SharePoint Designer and got the popup dialog: “Failed to load the workflow.”  (I had already loaded .NET 3.0 to get the Workflow Foundation Classes.)
A little searching, and I found the answer in Scott Muller’s blog: Navigate to C:\Documents and Settings\<your user name>\Application Data\Microsoft\SharePoint Designer\ProxyAssemblyCache and delete the existing folder (12.x.x.xxxx).  (You’ll have to shut down SharePoint Designer for the delete to work.)  I’m not sure why it works, but it works!

Known issue: Office 2007 on Windows Vista prompts for user credentials when opening documents in a SharePoint 2007 site

If you’ve been using Office 2007 on a Vista machine for as long as I have, you may have just gotten used to the extra credential prompts when you open Office documents from SharePoint 2007.  Well, Microsoft considers this a "known issue", but it’s not clear when it may be resolved for good, though it may be in Vista SP1.

In the meantime, there is a hotfix you can get, but you must ask Microsoft for it.  See the article entitled ‘You are prompted to enter your credentials when you access an FQDN site by using a Windows Vista-based client computer that has no proxy configured’ for the details.  The hotfix will only work for the SharePoint sites that you specify in the registry, so it is just a temporary workaround.

SharePoint Data View Web Part Extension Functions in the ddwrt Namespace

Serge van den Oever wrote this MSDN article about the functions that are available in the ddwrt namespace.  He wrote it for SharePoint 2003 and posted it to MSDN in October 2005, but I’ve never found a newer or better reference for MOSS.  I’ve used Serge’s postings many times to help solve challenges, and I recommend him if you ever run across them.

I’ve found a few additions to Serge’s list below, but I haven’t been able to find documentation for most of them:

Function   (ddwrt:) Called with   (example) Result
amkeyfield ddwrt:amkeyfield=”ID” ???
amkeyvalue ddwrt:amkeyvalue=”ddwrt:EscapeDelims(string(@ID))” ???
ammode ddwrt:ammode=”view” ???
cf_ignore ddwrt:cf_ignore=”1″ ???
EscapeDelims ddwrt:EscapeDelims(string(@ID)) ???
EcmaScriptEncode ddwrt:EcmaScriptEncode(string(@ID)) Encodes a string   into the ECMAScript format.

Here are a few excerpts from Serge’s article (any references to FrontPage are still valid for SharePoint Designer):


Microsoft Windows SharePoint Services provides the powerful Data View Web Part that can perform an Extensible Stylesheet Language Transformation (XSLT) on XML data retrieved from a data source. When you are working with a Web site based on Windows SharePoint Services from within Microsoft Office FrontPage 2003, you can use the Data View Web Part to do the following:

  • Define a query and data source from which to retrieve the XML data. Data sources can be SharePoint lists or external databases such as Microsoft SQL Server.
  • Define the XSLT transformation that converts XML retrieved from the data source into HTML. FrontPage offers a WYSIWYG experience for editing these XSLT views, including live data preview.

During the XSLT transformation process, the Data View Web Part uses an XSLT extension object that provides several functions in the ddwrt namespace. These functions perform tasks such as accessing properties of a SharePoint list or firing events to connected Web Parts. This article describes the functions implemented by the extension object.

Following is information about the set of functions implemented in the ddwrt namespace. These functions are prefixed with ddwrt in the XSLT code that is generated by FrontPage.


Rolling Up Content in SharePoint Using the Data View Web Part (DVWP)

In a recent post, I pointed out a way to roll up calendar entries using the Data View Web Part (DVWP).  That approach works if you have a fixed set of calendars for which you’d like to display the roll-up.  But what if you’d like the roll-up to be dynamic, i.e., have it display events for any new calendars that are created below a certain place in your site hierarchy?

Well, the way to do this is still using the trusty old DVWP (how could we live without it?!?!?!).  There are several DataSourceModes that are available in the DVWP that aren’t exposed in the SharePoint Designer interface.  (ListofLists, Webs, and CrossList modes. ListsofLists and Webs modes show the collection of lists and the collection of subsites for a given site.)  The mode that we need here is CrossList, which allows us to display items across lists below a certain point in the site hierarchy.

Here are the basic steps:

  • Set up your DVWP so that it has the display that you want for all of the lists, but do it the way you normally would for a single list. (i.e., pick one of your lists and make everything pretty for it alone.)
  • Now, if you aren’t already there, switch to code view, and in the code for your DVWP find the DataSourceMode property and change it from List to CrossList.
  • Right after that property, you’ll see the SelectCommand property.  This is the code that tells the DVWP what query to use for the SPDataSource.  Add <Webs Scope=’Recursive’></Webs> immediately after the opening quote, and leave the rest of the SelectCommand as it is.
  • Immediately after this section, you will see values for <SelectParameters>, <DeleteParameters>, <UpdateParameters>, and <InsertParameters>.  You can delete all of these, as they are not relevant to the CrossList mode.
  • Down a little further, you’ll see the <ParameterBindings> section.  Make sure that the line <ParameterBinding Name=”WebURL” Location=”None” DefaultValue=”/sitename/subsitename/”/> reflects the “root” from which you’d like the rollup to work.  (i.e., the DVWP will shown all items from this site and below — That’s what the Recursive scope you put into the SelectCommand does.)
  • Lastly, go a little further down and make sure that the path in the line <xsl:param name=”WebURL”>/sitename/subsitename/</xsl:param> matches the one above.
  • You can also remove any references to ListIDs, as they aren’t relevant.

If you’ve done everything right, you should see items returned by the DVWP that come from all of the like-structured lists below the site you’ve indicated.  You can continue to make formatting changes in the XSL, but to me it seems easier to get it at least close to right before you switch to CrossList mode.

NOTE: I posted an update to this post on September 21, 2008.  You should read that followup in conjunction with this post.