Sunday, December 23, 2007

Merry Christmas and Happy New Year!

2007 is almost over, and I hope it's been productive, successful, and happy for you. Best wishes for a great holiday season, and good luck in 2008!

Cheers,

Nick

Christmas Tree, Martin's Place Sydney

Tuesday, December 18, 2007

Multilingual MOSS

I investigated MOSS variants briefly in the Beta days but the language packs weren't out so I never had a chance to really play with them, until today.

I'm still learning about the feature set but I hope these instructions will help other people who need to setup or manage multilingual SharePoint portals.

Installing SharePoint Language Packs

To install the MOSS language kits:

  1. Change the Regional settings of your Web Front End, Query, and Index servers to support the additional languages by going to Control Panel > Regional and Language Option and adding the languages you intend to support.
  2. Download the MOSS language packs (make sure you pick the correct language from the drop-down list first!). The URL is http://www.microsoft.com/downloads/details.aspx?FamilyID=2447426b-8689-4768-bff0-cbb511599a45&DisplayLang=en
  3. Install this on your MOSS server.
  4. The installation, when complete, will prompt you to run the SharePoint Products and Technologies Configuration wizard. Do not change any of the settings and click "Do not disconnect from this server farm" if you see that option.
  5. All languages are installed in \Program Files\Common Files\Microsoft Shared\web server extensions\12\template\[number of the language, eg 1033 is English)

Testing The Variants

To test the variants functionality I have installed the French language pack and set up variants for English (Canada) and French (Canada).

  1. In your portal create a new site using the Publishing or Publishing Site with Workflow site template
  2. Go to the site collection and in Site Actions > All Site Settings, click "Variations"
  3. Browse to your publishing site (normally this will probably be your root publishing site, but this could be anywhere in your site collection). Leave the defaults and click OK.
  4. Go back to Site Actions > All Site Settings and click Variation Labels
  5. Create a variant label called en-CA and make it the source. Choose Publishing Site with Workflow.
  6. Variant Labels Create a new variant label called fr-CA, with display of French (Canada) and culture French (Canada).
  7. Go back to the list of labels (you should see both) and click "Create Hierarchies".All Variant Labels - Hierarchy Created
  8. Now the hierarchy will be set so en-CA is our source and fr-CA is our target.

Now we need to start modifying content and seeing how the variants work in practice.

  1. In Central Admin, there is a Variations Propagate Page Job Definition and Variations Propagate Site Job Definition that will run to publish any changes.
  2. Go to the publishing source site and edit some content and publish it with approval. A reminder will tell you to check for unpublished items, if you forget.
  3. After the content is published and approved, and the variation job has kicked in (usually a minute or two) the content will appear in your variant sites. You will still have to modify, translate, and approve those as normal.

Browser settings

When you visit a variant site in MOSS, the browser will try to default to your preferred language if it can detect it. You can experiment by adding a new French (France) (FR) variant  label  (in addition to the French (Canada) one) and then  adding French (France) and French (Canada) (FR-CA) to your internet browser's languages list.

Browsing to the root translation site will cause it to pick which label to use - if I put the France language first in my browser list of preferred languages, it will bypass the FR-CA site and show me the FR variant instead.

Gotchas

  1. If you create subsites, they have to be publishing sites to preserve this language ability. If you make a team subsite for instance it won't handle the variants for you.
  2. If you add new language labels later on, you have to create hierarchies again.
  3. If you add a new language variant, it doesn't seem to pick up the existing content, so you might have to "force" the update by modifying the source content again, even if it's just to update it with no changes - so if you are going to use variants plan ahead and try not to add language packs over time!
  4. If you update the source content, it seems to overwrite the target translations (although a version will be saved for them). This is a big GOTCHA!
  5. The use of publishing approval workflows is a very good idea because this kind of content translation usually requires some level of publishing oversight. However if you're testing variants in development it can involve a lot of clicking and approving, and sometimes it's easy to forget to approve content.

Are any of you using this in production? What do you like about the system, what gotchas have you found, what tips and tricks have you come up with?

Sunday, December 16, 2007

"Our World" - Free Environmental Site Templates

I thought it might be fun to create an environmental initiatives site template for MOSS 2007. The goal is to help organizations track the impact their policies have on the environment, in the hope of raising awareness around ecological issues.

I've tried to stay away from the political aspects of this kind of effort. There are links to several national environmental organizations, an RSS subscription to World Wildlife Foundation, and a link to a carbon footprint calculator, but I left out anything I thought might be too regional or controversial.

I've included an Excel spreadsheet I created asking some general questions about an organization's environmental policies. It's the standard 1 to 5, Strongly Disagree to Strongly Agree questionnaire format, and no it's not very scientific!

There are also a handful of nature images in the picture library - you are free to use those inside your portal.

I started with a blank site definition and used as many MOSS web parts as I could. There are two versions of the site templates: the first is for MOSS Standard license and contains the basic site, called "Our World". Feel free to change the site template name if you find it too cheezy :)

The Enterprise License version includes a child site called the Environmental Initiatives Dashboard. It's got KPIs mapped to the questions in the Excel spreadsheet.

  • To download the Standard .stp file contained in a zip file, click here. It is 4.8 megs.
  • To download the Enterprise version, I've created a zip file  containing 2 site templates (5 megs). First install the OurWorldEnterprise.stp file into your portal. Then under it, create a subsite with a url of "dashboard" (otherwise the links won't work). Pick the OurWorldDashboardEnterprise.stp site template and you should be good to go.

SharePoint's so easy to customize that the total effort was only a couple of hours, including all content generation. This is only a starting point - I would really love to hear from you about the site templates, especially if

  1. You are using them,
  2. You are making improvements to them, and / or
  3. You have other ideas on what can be done to them

Oh, last but not least - these site templates are licensed under Creative Commons Attribution ShareAlike 3.0. This means that you can use the template for business purposes (although you can't sell it), but you can only redistribute the template or derivative works under the same license terms. So you are pretty much free to modify and share as you like!

Enjoy!

Wednesday, December 12, 2007

SharePoint Service Pack 1 Released

SharePoint Service Pack 1 was released yesterday.

Joel Oleson has a detailed post on the update at http://feeds.feedburner.com/~r/sharepointteamblog/~3/198847357/announcing-the-release-of-wss-3-0-sp1-and-office-sharepoint-server-2007-sp1.aspx.

Joel mentions that a special page has been created on TechNet: http://technet.microsoft.com/en-us/office/sharepointserver/bb735839.aspx to help people evaluate and apply the service pack. He encourages everyone to look before they leap when it comes to applying the service pack.

The SP download is here: http://www.microsoft.com/downloads/details.aspx?FamilyId=9EC51594-992C-4165-A997-25DA01F388F5&displaylang=en

Tuesday, December 11, 2007

Quick and Dirty Web Parts

SharePoint is a joy for Rapid Application Development and prototyping. It's great fun to sit with clients and run up site hierarchy or document taxonomy on the fly, in response to their direct feedback.

When it comes to any custom development, there is a bit more heavy lifting - especially if there's a requirement for custom web parts. This starts to involve Code Access Security, custom control lifecycles, and change management.

What if you just want to do some RAD custom development?

There are some nifty shortcuts to help with web part prototyping. First of all, the SmartPart and Son of SmartPart are wonderful little controls created by Jan Tielens. They make it easy to create custom user controls with full design support and then make those work in a SharePoint context.

In a similar vein, MOSS includes the very useful Page Viewer Web Part. This is available right out of the box with no assembly required. Follow the steps of this example to use it with very little effort:

1. Create a basic web page, Default.aspx with the following script:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CustomSharePointWebApp._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="Field1" runat="server"></asp:TextBox>
        <asp:Button ID="SubmitButton" runat="server" Text="Button" />
        <asp:Label ID="ResultLabel" runat="server" ></asp:Label></div>
        <asp:RequiredFieldValidator ID="Field1RequiredFieldValidator" ControlToValidate="Field1" ErrorMessage="Field 1 cannot be empty" runat="server"></asp:RequiredFieldValidator>
    </form>
</body>
</html>

2. Use the following code for the code-behind:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace CustomSharePointWebApp
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                ResultLabel.Text = Field1.Text;
            }
        }
    }
}

3. Now right-click the project file in the Solution Explorer and click "Publish". For target location, enter the full path to the _layouts folder as well as the name for your custom app, ie:

http://[Your Sharepoint Portal]/_layouts/[Your web app name]/

This will automatically migrate the code and create a folder in the _layouts directory.

4. Now create a test team site somewhere on your portal. Add a Page Viewer Web Part to the page, and point its link to your application's default.aspx page.

5. You should now see your application appearing in the team site, with full SharePoint context, Master Page, and site hierarchy. Notice that in the example we created, the default.aspx application lifecycle is handled completely outside of SharePoint. By deploying it in the _layouts folder we can lstill everage the SharePoint user context if we need to (for security trimming, user profile information and the like).

Custom Form with Page Viewer

Happy prototyping!

Caution: The Page Viewer Web Part uses iFrames, which present some potential security concerns, such as cross-site scripting attacks. iFrames are probably safest if hosted internally; don't deploy these to public-facing sites unless you've closely examined the security implications!

Saturday, December 01, 2007

SharePoint Kits

There's some cool pre-Christmas SharePoint gifts here or almost here:

First off, SharePoint Service Pack 1 is on the way. There are some new stsadm commands, a rollup of the various hotfixes that have come out, and support for creating custom web parts with the AJAX toolkit.

The SharePoint Team Blog dives into all the details at http://blogs.msdn.com/sharepoint/archive/2007/11/29/preview-into-wss-3-0-sp1-and-sharepoint-server-2007-sp1.aspx.

Just released is the Accessibility Kit for SharePoint from HiSoftware and Microsoft. I've blogged about this in the past and it will be important to many organizations that have been unable or unwilling to consider MOSS for public portals due to accessibility requirements. It's available on CodePlex. The nice touch with this kit is that it is intended to incorporate community contributions (as you'd expect on CodePlex) so the kit will improve as people contribute to it. The full details are at http://blogs.msdn.com/sharepoint/archive/2007/11/28/announcing-the-accessibility-kit-for-sharepoint-aks-1-0.aspx.

Finally, if you work with Business Objects, you'll be pleased to know they just released a free integration kit for SharePoint called the "BusinessObjects Enterprise XI R2 SharePoint 2007 Portal Integration Kit" (or BO E XI R2 SP 2007 PIK for short). You can download that here (5 mb zip file). The kit includes document and list view web parts to help create dashboards.

Each of these releases opens up worlds of development possibilities. The depth of SharePoint's integration capabilities continues to increase, and this is just Year One!