Archives

Archives / 2006 / April
  • Using Office SharePoint Designer 2007 with SharePoint 2003

    Note: the information in this weblog post is based on the Beta version of SharePoint Designer 2007 (version 12.0.3820.1002), the information might not reflect the working and available functionality of newer beta versions or the final product.

    Did you know you can use the new SharePoint Designer 2007 on SharePoint 2003 sites? Well… it works! Still looks a lot like FrontPage, but it has some great new features. It can be installed side-by-side with FrontPage 2003, but switching between SharePoint Designer and FrontPage causes some strange error messages and automatic reinstallation/reconfiguration actions. Don’t try it on a machine where you depend on for real development work, after switching my FrontPage I had some strange behavior.

    NOTE: I’m running WSS 2.0 SP2 under ASP.NET 2.0, I don’t know if everything reported here works the same for ASP.NET 1.1.

    Ok, after all the warnings and disclaimers: let’s get started!

    SharePoint Designer 2007 and WSS 2

    Although FrontPage is renamed to SharePoint Designer, it looks like all the non-SharePoint functionality that was available in FrontPage is still available. I will look at the available fatures in the context of WSS 2, not the new WSS 3 (SharePoint 2007) platform.

    For the Microsoft marketing speech on the full features of SharePoint Designer for SharePoint 2007, have look at http://www.microsoft.com/office/preview/programs/designer/highlights.mspx.

    Master pages

    Earlier I already tried to create a master page for usage with a WSS page, but didn’t get it working. I’m using ASP.NET 2.0 with WSS 2, so I actualy thought that that might work. I think that due to changes to the page the page got unghosted, and the Safe Mode parser prevented the usage of master pages. I didn’t try to add a master page to the site definition, that might work because ghosted pages linking to the pages in the site definition are not interpreted by the Safe Mode parser, but directly by ASP.NET 2.0.

    SharePoint Designer has the capabilities to design a master page through File - New – Page – Master Page.

    SDNewMasterPage

    New content regions can be added through Format – Master Page – Manage Content Regions …, which hows the following dialog:

    SDMasterPageRegions

    I even managed to create a page based on the master page:

    SDAppliedMasterPage

    When I load the test.aspx file in the browser I get the following error however:

    [WebPartPageUserException: Unknown attribute "masterpagefile" found in @Page directive.]

    The page is unghosted and does not seem to support master pages. I think due to the all the restrictions that exists for pages executed by the Safe Mode parser

    Gladly enough good old Dynamic Web Templates, one of the most powerful and overlooked features in FrontPage,  is still suported.. Where master pages combine at runtime, Dynamic Web Templates combine on save or attach of the Dynamic Web Template file I will spend a separate weblog entry on this topic in the near future.

    CSS Styles

    SharePoint Designer has a nice style selector to select a style of one of the connected stylesheets:

    SDCssSelector

    Data View

    One of the renamed menu entries is Data View, which was named just Data in FrontPage 2003. Data Views are one of my favorite parts of WSS, and it is good to see that Data Views will still be there in WSS 3 and the support within SharePoint Designer is better than ever. Some disassembling of the Data View Web Part code and DDWRT XSLT function extension code in WSS 3 reveals that not much changes in the new version of WSS.

    One of the biggest problems with FrontPage 2003 was that when data was retrieved for a Data View, the data querying could become really slow when a lot of items are retrieved. This made the user-interface often really sluggish. Data Views now have a special Data View Preview setting that solves these kind of problems:

    SDCommonDataViewTasks

    Another good improvement in Data View editing is the Data View parameter editor:

    SDDataViewParameters

    This translates in the following parameter bindings in the Data View Web Part:

    <ParameterBinding Name="ParamConnection" Location="Connection" DefaultValue=""/>
      <ParameterBinding Name="ParamControl" Location="Control(L_SearchView)" DefaultValue=""/>
      <ParameterBinding Name="ParamForm" Location="Form(FormField)" DefaultValue=""/>
      <ParameterBinding Name="ParamCookie" Location="Cookie(MyCookie)" DefaultValue=""/>
      <ParameterBinding Name="ParamQueryString" Location="QueryString(queryvar)" DefaultValue=""/>
      <ParameterBinding Name="ParamServerVar" Location="ServerVariable(servervar)" DefaultValue=""/>

    The editing of the Data View properties is a bit extended, but the supported functionality didn’t really change:

    SDDataViewProperties

    The Layout possibilities didn’t change, and there seems to be no way to extend the layouts. Specifying your own XSLT in the XSLT Source tab is new as far as I know.

    The column header sorting bug is NOT solved in XSLT generator of SharePoint Designer.

    The conditional formatting is made even more powerful due to a good style composer and good support for the creation of the xpath rules for conditional formatting. The biggest problem is still there: it is NOT possible to specify a CSS class for styling a conditional format. Microsoft: please change that, you want to be able to maintain style in a centralized place!

    Conclusion

    SharePoint Designer is a cool tool that makes nice improvements on the current SharePoint 2003 version that is already really powerful. It is great that all the already available power in SharePoint 2003 that is now “banned” due to the unghosting issues will be “the way to go” in the next version of SharePoint because the unghosting issues and Safe Mode parser will be something of the past.

    SharePoint Designer is not production ready yet. I had a few crashes in preparing this blog entry. But start learning FrontPage 2003 now, and you will enjoy SharePoint Designer 2007 even more when it hits the market!

    In some future blog entries I will describe the way we use FrontPage 2003 to build really powerful business application on the SharePoint development platform today.

  • Great book on the more advanced configuration capabilities in SharePoint 2003

    I just finished browsing through a new book on advanced SharePoint customizations:

    SharePoint 2003 Advanced Concepts: Site Definitions, Custom Templates, and Global Customizations By Nadrowski, Jason/ Draper, Stacy Published by Addison-Wesley, Microsoft Windows Server System Series ISBN: 0321336615; Published: 3/13/2006; Copyright 2006; Pages: T; Edition: 1

    Check the link for an example chapter.

    It is a small book (247 pages) that has great focus. I hate those 1000 pages books that pretend to cover everything, but only scratch the surface on a zillion topics. This book its focus in on creating site definitions, and it does this well with a lot of valuable tips and good examples. It covers some other topics as the backcover mentions:

    · Construct more powerful site and list templates

    · Control how SharePoint uses ghosted and unghosted pages

    · Use custom site definitions to gain finer control over your site

    · Build list definitions with custom metadata, views, and forms

    · Troubleshoot WEBTEMP, ONET.XML, SCHEMA.XML, SharePoint databases, and their interactions

    · Create custom property types to extend SharePoint's functionality

    · Integrate with other systems and SharePoint sites so that you can use their information more effectively

    · Change themes and edit Help, one step at a time

    · Customize email alerts and system notifications

    · Extend the capabilities of document libraries

    · Control document display and behavior based on extensions

    Most information is also available from other sources like the SharePoint SDK documentation, articles on MSDN and blog entries, but here you get a good written, easy read that gets you into the topic in a matter of hours.

    Highly recommended if you need to get up to speed quickly on the topic, and don’t really care to spend a few bucks. But don’t take only my words for it, always check Amazon for the latest reviews.

  • BUG&FIX: SharePoint Data View column header sorting not working with namespaced XML data

    We (Serge van den Oever and Victor Vogelpoel [Macaw]) found a bug with column header sorting within Data View Web Parts when we use a custom web service as the data provider.


    It seems that column header sorting is not working without removing the namespace prefix for the header field names in the XSLT of the Data View. When trying to sort in the Data View Web Part the header indicates a sorting order, the ascending and descending arrows are showing, but the actual sorting of the data is not executed.

    Let us explain it step-by-step:

    We have a web service that produces a non-dataset diffgram result, it actually just produces data in the following format:

    <?xml version="1.0" encoding="utf-8" ?>
    <ArrayOfAccount xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:my-namespace:webservice:v1">
      <Account>
        <AccountName>Abn Amro</AccountName>
        <AccountCode>ABN</AccountCode>
      </Account>
      <Account>
        <AccountName>Nederlandse Spoorwegen</AccountName>
        <AccountCode>NS</AccountCode>
      </Account>
    </ArrayOfAccount>

    As you can see in the XML all data is within the namespace “urn:my-namespace:webservice:v1”.

     

    In our code we deliver data that comes as an array of the following struct:

    public struct Account
    {
            public string AccountName;
            public string AccountCode;
    }

    The web service code is as follows:

    [WebService(Namespace = "urn:my-namespace:webservice:v1")]
    public class AccountService : WebService
    {
      [WebMethod]
      public Account[] GetAccounts()
      {
        ….
      }
    }

    When we insert a Data View for this web service on a web part page using FrontPage 2003 and enable “Options—>Enable sorting on column headers” on the Data View Web Part, the headers of the columns show up fine in the Data View (AccountName and AccountCode), but the underlying fieldnames for the headers are prefixed with a mapped namespace (ddw1:AccountName and ddw1:AccountCode). This results in the following XSLT code for the header:

    :
    <th class="ms-vh" nowrap="true">
      <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1">
        <xsl:with-param name="fieldname">ddw1:CompanyName</xsl:with-param>
        <xsl:with-param name="fieldtitle">CompanyName</xsl:with-param>
        <xsl:with-param name="sortable">1</xsl:with-param>
        <xsl:with-param name="attachments">0</xsl:with-param>
      </xsl:call-template>
    </th>
    :

    If the namespace prefix (shown in bold) is removed, sorting start working again!

    When a DataSet or DataTable is returned as the result of a web service call this problem does not occur. The reason for this is that the diffgram part of the DataSet or DataTable XML result is not part of the namespace of the web service.