October 2008 - Posts

You probably know that if you want to make use of the fancy new .NET stuff, like ASP.NET AJAX in SharePoint 2007 sites, you have to make a bunch of modifications in the web.config of that site. You can do that the manual way, for example Mike Ammerlaan has described how you can enable ASP.NET AJAX 1.0 in SharePoint sites already a long time ago. Recently .NET 3.5 (including a new version of ASP.NET AJAX) became available, including the steps that you needed to go through to be able to enable it in SharePoint sites. You can check out Tobias Zimmergren’s post for example to get an idea.

Of course the manual approaches work, but it’s quite a lot of XML that you have to copy-and-past into the SharePoint web.config files. If you prefer an automated way to apply those changes, you can check out the SharePoint 2007 Features project on CodePlex. Over there you can find some feature that will apply the changes for you. But before you get too excited; make sure you test those features in your farms, because I’ve had some nasty experiences deploying them in SharePoint farms with multiple front-end web servers.

Today I’d like to introduce you the lazy way to apply the necessary changes for enabling .NET 3.5 (including the corresponding version of ASP.NET AJAX) in SharePoint 2007 sites. Actually it’s my lazy U2U colleague Lieven Iliano who thought me the trick, and I’ve been using it ever since in my classes and demos. The trick is to slightly abuse Visual Studio 2008 (just a little bit) here are the steps:

  • Start Visual Studio 2008.
  • Create a new dummy ASP.NET Web Application Project, and make sure you target the .NET Framework 2.0 (upper right dropdown of the New Project dialog). The name of this project is not important; you won’t need it anymore when we’re done.
  • Copy the web.config of your SharePoint 2007 site, into the dummy Web Application project in Visual Studio.
  • Open the Project Properties in Visual Studio (right click on the Project node in the Solution Explorer, and choose Properties; or in the Project menu, select WebApplicationX Properties).
  • Select .NET Framework 3.5 in the Target Framework dropdown (select Yes in the confirmation dialog).
  • Copy the web.config from the Web Application Project back to SharePoint.
That’s it; you now have copied the upgraded web.config to the SharePoint site! At this moment you’re ready to make use of all the fancy new .NET 3.5 stuff in your SharePoint 2007 site.

It is great to find out people like the articles you write on your blog, and it's even more fun when people actually contribute to your blog as well. That's how I received an update to a blog post I wrote some time ago, about adding breadcrumb navigation to Application Pages. Bart Snyckers explained that the mechanism described in my post worked a little bit different if you want to add Application Pages to the Central Administration site. Bart doesn't have a development blog yet (but he told me he's working on one, and he's running a photo blog already), so I'm posting Bart's findings below. Thanks Bart!

 

Recently we also wanted to add breadcrumb navigation to some Application Pages for SharePoint, which we were using in our Central Administration, like the out-of-the-box Application Pages have. But it didn't worked out the way I wanted to. Google showed me the way to Jan Tielens’ blogpost about Adding breadcrumb navigation to SharePoint Application Pages, The easy way.

 

But after some research I found out that Application Pages that you want to show in the SharePoint Central Administration Site should be placed in different folders than normal Application Pages (in collaboration or publishing sites for example). When you are building up your 12-hive structure you should use 12\TEMPLATE\ADMIN for the Application Pages (*.aspx) and sitemap (admin.sitemap.*.xml) files, instead of the 12\TEMPLATE\LAYOUTS. If you mix up the .aspx and .sitemap files between the ADMIN and LAYOUTS folder, the breadcrumbs just don't appear at all and if you place everything in the LAYOUTS folder, the breadcrumbs don't work like you expect them to do. Further you have to reference the correct MasterPageFile from the ADMIN folder as well.

 

To deploy your feature and let SharePoint add the sitemap entries, you can use the methods described in Jan's article.Below you can find a small example to provision an Application Page in the Operations tab in your Central Administration:

 

Application Page (.aspx), deployed to 12\TEMPLATE\ADMIN

<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>

<%@ Assembly Name="Example.SharePoint.CentralAdminApplicationPage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2de06805bd3065de"%>

 

<%@ Page Language="VB" MasterPageFile="~/_admin/admin.master"

         Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>

 

<asp:Content ID="content1" ContentPlaceHolderID="PlaceHolderMain" runat="server">

      Central Administration Application Page

</asp:Content>

 

<asp:Content ID="content2" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">

    Central Administration Application Page

</asp:Content>

 

<asp:Content ID="content3" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">

   Central Administration Application Page

</asp:Content>

 

Sitemap (admin.sitemap.*.xml), deployed to 12\TEMPLATE\ADMIN

<?xml version="1.0" encoding="utf-8" ?>

<siteMap>

      <siteMapNode title="Central Administration Application Page" url="/_admin/CentralAdminApplicationPage.aspx" parentUrl="/_admin/operations.aspx"/>

</siteMap>

 

Feature (feature.xml)

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"

  Id="{25397E25-C142-423a-97D2-AEA7BA6C0879}"

  Title="Central Administration Application Page"

  Description="Enables the Central Administration Application Page."

  Scope="Site"

  ReceiverAssembly="Central Administration Application Page, ..."

  ReceiverClass="Example.SharePoint.CentralAdminApplicationPage.FeatureHandler">

  <ElementManifests>

    <ElementManifest Location="customactions.xml"/>

  </ElementManifests>

</Feature>

 

Customactions (Customactions.xml)

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

      <CustomActionGroup

        Id="{79C8B7A7-E258-4835-B12D-D592F9CE100E}"

        Title="Central Administration Application Page"

        Location="Microsoft.SharePoint.Administration.Operations"

        Sequence="100" />

      <CustomAction

            Id="{828008F8-20DB-4224-8D2C-A4826C66E874}"

            Title="Example Application Page"

     

            GroupId="{79C8B7A7-E258-4835-B12D-D592F9CE100E}"

            Location="Microsoft.SharePoint.Administration.Operations"

     

            RequireSiteAdministrator="TRUE"

            Sequence="10">

            <UrlAction Url="/_admin/CentralAdminApplicationPage.aspx"/>

      </CustomAction>

</Elements>

According to the countdown timer at the PDC2008 site, the opening keynote is only 17 days away (at the time of writing). The previous PDC in 2005 was all about Office 2007 (including SharePoint) and Vista, but this time there didn't seem to be a lot of Office/SharePoint content scheduled. Not that this is a bad thing; after 3 years of SharePoint teaching, coding and evangelizing, getting to know new technologies can be great. :-) I'm really looking forward to learn more about Live, Live Mesh, Cloud Services etc.

But if you check the PDC sessions now,  you can find five SharePoint related sessions. For a nice summary check Paul's blog post here. Hey there will even be a SharePoint booth! So I hope to meet you in LA!

More Posts