Forming URLs in TFS WebpageControlOptions


The greatest thing about a technical blog is that it gives you an opportunity to memorialize dumb mistakes in the hope that it will show up in the first few search results when other run into the same issue rather than having to track through other pages that don’t quite match.  This is one of those cases. 

I have started to incorporate WebpageControl fields in my TFS 2010 WIT definitions to provide better process guidance, but also to provide dashboard-style feedback to the person filling out the form.  One of the neatest features is the ability to have the page post every time one of the WIT fields referenced in elements is changed.  This is especially useful if you are binding the to the current value before it is saved giving the use live feedback.  How cool is that?!

There I was, working my WIT mojo, only to end up with this unfortunate error:

Error importing work item type definition:
‘=’ is an unexpected token.  The expected token is ‘;’.  Line 203, position 176.

How annoying?

The only good part of this is that the fix is simple and really something I should have caught when updating the XML on the WIT definition.  In this case, the error came in having the ampersand symbol (&) in the URL as part of the querystring without translating it to & as I should have.  I like it when the fix for an oversight like this is fast.

For those interested, a cleansed version of the XML for the WebpageControl I am using is below.

              <Control Type=”WebpageControl” Label=”” LabelPosition=”Left” Name=”ReportStoplight”>
                  <WebpageControlOptions AllowScript=”false” ReloadOnParamChange=”true”>
                        <Link UrlRoot=”@ProcessGuidance” UrlPath=”reports/stoplight.aspx?S1={0}&amp;S2={1}”>
                          <Param Index=”0″ Value=”Namespace.StatusEarnedValue” Type=”Current” />
                          <Param Index=”1″ Value=”Namespace.StatusBudgetVariance” Type=”Current” />
                        </Link>
                 </ WebpageControlOptions>
              </Control>

I simplified this to just two parameters, but you get the idea.  If you’d like more information about using the WebPage Controls, have a look at these resources:

WebpageControlOptions http://msdn.microsoft.com/en-us/library/dd936135.aspx
Link and Param Elements http://msdn.microsoft.com/en-us/library/dd936107.aspx

Advertisements

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s