My new blog

My blog has moved to www.davehunter.co.uk/blog see you there.

Thursday, 31 May 2007

Colour Picker

Recently I've been customising the look and feel of SharePoint 2007 for a client. I needed to get the hexadecimal colour codes from an existing website, but the website was using flash. I found this colour picker http://iconico.com/colorpic/ very helpful and best of all its free.

MOSS Query Tool

If you haven’t seen it already, its worth looking at the MOSS Query Tool. It’s great for searching your index and creating CAML search queries.

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=89b3cda7-aad9-4919-8faf-34ef9b28c57b







Tuesday, 29 May 2007

MOSS Variations …. Customising the landing page logic

The out-of-the-box variation landing page functionality in SharePoint 2007 is very flexible (the default language is based on your browser settings), but if you want to provide a more strict route into your site. For example: A site which is predomiately in German would want to show German first and then allow the user to select another language. You can do so by:

1. Setup variations with the default language as the source variation. For example: DE.
2.
Customising the root landing page, for more information http://msdn2.microsoft.com/en-us/library/ms562040.aspx
2.1. I chose option 3 as the best approach as this would only affect one site and I'm not fond of inline code.
2.2. Write a class inheriting from the System.Web.UI.WebControls.WebControl class containing the code below.
2.2. Add the assembly into the GAC and SafeControls in web.config
2.3. Replace the original logic in the VariationRootLandingPage with the custom server control.

You have now customised your multi-lingual site to redirect visitors to your default language (source variation).


#region namespaces
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Publishing;
#endregion

namespace MOSS2007.Sample.Multilingual
{
public class LanguageSwitch : System.Web.UI.WebControls.WebControl
{
#region overriden methods

///


/// Override the onload event to redirect the user to a variation based on where they came from
///

///
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

try
{
// get the current variation labels
ReadOnlyCollection spawnedLabels = Variations.Current.UserAccessibleLabels;

string url = "";

if (spawnedLabels.Count > 0)
{
// loop through the labels to find the source label
foreach (VariationLabel label in spawnedLabels)
{
// get the source variation url
if (label.IsSource)
{
// send the user to the source variation
url = label.TopWebUrl;
break;
}

}
}

// redirect the user to the source variation
SPUtility.Redirect(url, SPRedirectFlags.Default, Context);

}
catch (Exception ex)
{
Context.Response.Write(ex.Message);
Context.Response.Write(ex.StackTrace);
Context.Response.Write(ex.Source);

if (ex.InnerException != null)
{
Context.Response.Write(ex.InnerException.Message);
Context.Response.Write(ex.InnerException.StackTrace);
Context.Response.Write(ex.InnerException.Source);
}
}
}
#endregion
}
}

First Post

Hello and welcome to my blog.

Who am I?
My name's Dave Hunter. I'm currently working as a senior consultant at CIBER UK. I've been working with Microsoft Information Worker technologies for nearly 6 years. My main depth of knowledge and skills are with Microsoft CMS and SharePoint. I started working with MCMS when Microsoft aquired the product in 2001 and have been working with it ever since. More recently I have been working with MOSS 2007 (since beta 2).

What's the aim of the blog?
Share my experiences, learnings from working with MOSS 2007.

Please note: Information on this blog is my own thoughts and not any representation of CIBER UK's or Microsoft's.