Sunday, July 09, 2006

A great article for WCM programming in Sharepoint 2007

There is a nice article that demostrates the API mapping between CMS 2002 and Sharepoint 2007 with lots samples. This is a the best one I found so far for programming WCM in Sharepoint 2007.

MOSS 2007 and WSS 3.0 Master Page

It would be a very bad experience if you have ever tried to change the interface of Sharepoint Portal 2003. But MOSS 2007 and WSS 3.0 bring a new concept: the master page. The master pages are same as master pages used in ASP.NET 2.0. They define the look and feel and standard behavior in your site and make the customization a lot easier.

Master page combined with the page layouts, the content type, it produces the output of the pages with standard feel and look. The page layout is similar to the content page in
ASP.NET 2.0, which points to a master page and implements the content placeholders.

By default, the master page used in MOSS 2007 or WSS 3.0 is side wide. It means when you change the master page, it effects the look and feel changes in all pages in the site. These master pages are referenced as two dynamic tokens.

Two Dynamic Tokens


This token is used for the look and feel of all forms and views within the site, usually these pages are under _layouts directory. It is also called “Default master page” in Sharepoint Designer or “System Master Page” in “Site Settings\Look and Feel\Site Master Page Settings”. This master page token is used in the code of page layout page as

Page language="C#" MasterPageFile="~masterurl/default.master" ...

When Sharepoint loads the page, the token “~masterurl/default.master” is replaced at run time by the value in MasterUrl property of SPWeb.

To specify a master page for this token, by browser you can navigate to Site Settings\ Look and Feel\Site Master Page Settings, and select a master file from “System master page” dropdown as following picture.


This token is used for all publishing pages within the site. It’s also called “Custom master page” in Sharepoint Designer or “Site Master page” in “Site Settings\Look and Feel\Site Master Page Settings”. When you open the DefaultLayout.aspx, you will see the code like,

Page language="C#" MasterPageFile="~masterurl/custom.master" …

At run time, this token is replaced by the value in CustomMasterUrl of SPWeb object.

You can change the master page specified for this token in “Site Master Page” drowdown in Site Settings\ Look and Feel\Site Master Page Settings.

Also, these master page tokens are able to be changed in Sharepoint Designer by right click on the master page and select “Set as Default master page” or “Set as custom master page”.

Static Tokens

There are two static tokens for WSS 3.0 sites. If you the master page is in the master page gallery of the site, you can use it in your page by adding MasterPageFile=“~site/xxx.master”

If the master page is defined in the master page gallery in the root site, you can use by adding MasterPageFile=“~sitecollection/xxx.master” in your page.

DefaultPageLayout.aspx and Page Layouts

DefaultLayout looks like a special layout page defines the default layout for all publishing pages cross the site. The interesting thing is when you inspect the MasterPageFile attribute in all page layout aspx files, only DefaultLayout.aspx contains MasterPageFile attribute and its value is “~masterurl/custom.maseter”. The DefaultLayout.aspx is inherited from Microsoft.SharePoint.WebPartPages.WebPartPage but other page layouts including the page layouts created by you are inherited from Microsoft.SharePoint.Publishing.PublishingLayoutPage.

So I guess the PublishingLayoutPage class is somehow related to DefaultLayout.aspx, at least the master page of Defaultlayout.aspx will be re-used for all page layouts inherited from PublishingLayoutPage. So if you want to create a page layout use another master page instead of the Site Master Page (Custom master page), you need to change the base class from PublishingLayoutPage to WebPartPage and set the MasterPageFile attribute.

Friday, July 07, 2006

New blog

I have created a new blog on I will move most of my Sharepoint posts to there, but I will keep posting new articles on both sides.

Wednesday, July 05, 2006

Master Page and Page Layout ?

According to MOSS 2007 document, master page and page layout are working together as a template to control content pages' look, feel and content. In top site, there is a "Master page and Page Layout Gallery" and you could find lots out-of-box master and page layout (aspx) file there.

But I am frustrating in finding the relationship between master page and the page layout. It's able to create/upload many master pages or create many page layout, but I found all new page layout use default.master as master page and couldn't find a way to associate to other master page.

Does anybody know the answer?

Tuesday, July 04, 2006

Tips on Sharepoint Search Include Exclude path configuration

Last year when I was working on an enterprise search project with SPS 2003, I was frustrating on getting the rules that include or exclude content from content index work. I called Microsoft and I spent 3 hours with a Microsoft guy on the phone but got nothing useful.

After many hours testing by myself, I found the order or the include/exclude rules in a content index is very important and effects your search result enormously (But MS told us this doesn't matter.). I guest it is because each time when the search engine will index an URL, it first tests this URL against all rules one by one, and when it reaches the first satisfied rule, on matter it is an inclusion or exclusion rule, it returns immediately and ignores all following rules. For instance,

include: http://server/abc/*
exclude: http://server/abc/def/* ---- not working because the inclusion rule on top run first and block this exlcusion rule.

Friday, June 30, 2006

Microsoft Office Sharepoint Server 2007 Search and Search Ranking Algorithm Enhancement

The one of the biggest benefits that Sharepoint Server 2007 brings is the enhancements on search engine. Those enhancements include customizable interface of search result, customizable search scope definition, Boolean and Cross Site search, business data Catalog (BDC) search.

And one of the problems a current Sharepoint user must addresses is the ranking algorithm. The user wants not only the search returns as many document as possible but also to sort out the relevant document and display them at the top of the search result list. The ranking algorithm of the search engine shipped with SPS2003 is based on probabilistic relevance scoring, a technique developed in 70s, which called OKAPI algorithm. The ranking measurement is based on collection frequency, term frequency, document length and term position.

In the new version of Sharepoint, the Sharepoint Server 2007, it claims the ranking algorithm will be at least as good as any best-of-bread enterprise search engine in the market today. From the evaluation guild of beta 2, I found the ranking will be measured by:
  • Click distance
  • Hyperlink anchor text
  • URL surf depth
  • URL text matching
  • Automated metadata extraction
  • Automatic language detection
  • File type relevancy biasing
  • Enhanced text analysis

But I still need to see the reports coming out with comparison with SPS2003 and other search product like ultraseek, google mini …

Wednesday, June 28, 2006

I have found some help tips on promoting the blog more popular. I felt these points are pretty interesting:

1. Post multiple times per day. If you look at Engadget, Gizmodo, Lifehacker, Treehugger, Slashdot, or any of the top gadget/tech blogs you’ll see they post relentlessly. There’s always something new popping up in their rss feeds and on their sites. It’s a ‘dynamic’ thing.
2. Post about what’s hot like the other gadget blogs but also find stuff that they’re not posting about. Those things set your blog apart from the crowd and others will link up to those posts.
3. Send tips to the editors of the bigger sites, or any gadget/tech site for that matter. Even if they don’t post or link to you, they will be aware of you and subscribe to your feed and watch it for new and interesting stuff.
4. Link out to and trackback/pingback a lot of the smaller blogs as well. Not only will this get you some long term inbound links, it’ll build awareness of your blog with their readers.
5. Post and comment on other forums or blogs, etc. and follow up. Also, watch who’s linking in to your site and email them or comment on their site thanking them for the link. Relationship buliding, building awareness and visibility is huge when marketing any blog.
Darren over at does some great posting on professional blogging and I’d highly recommend reading his blog daily for traffic tips and strategies.

This is from site

Sunday, June 25, 2006

New terms in Sharepoint 2007

Feature - the list definition in site definition. (it's still define with CAML - a xml format used in Sharepoint from 1.0 to 3.0)

customize/uncustomize - unghosting/ghosting in Sharepoint 2.0

web application - virtual server in WSS 2.0

Content Type
Master file
Page Layout

Saturday, June 24, 2006

Blogging with Word 2007

I tried to use Word 2007 publish blog feature. It looks nice!

1. Write your post in Word 2007 as a normal document.

2. Click left-top corner ‘office’ button and select publish and then select blog.

3. In ‘new blog account’ dialog box, select ‘blogger’ for example.

4. Input your account information.

5. You will see an new Word 2007 window like this.

6. Enter the post title.

7. Click publish button.

8. Post then has been pushed to the blog.

Currently there is only beta 2 version available, and I couldn’t work out how to publish/upload the pictures in the document.

Comparison of MOSS 2007 WCM and MCMS 2002

This is the first post in the serial that I will write for the content management piece in Office Sharepoint Server 2007. I will try to compare the difference between the WCM of Sharepoint 2007 and the current MCMS 2002.

As you may already knew that Microsoft discarded its Content Management product line and make its new Sharepoint product as the content management platform. Almost all MCMS elements and terms that current MCMS developers familiar with are changed. To make me learn the new things easier, I did a comparison in following list:

MCMS 2002

Sharepoint 2007

Development Tools

Visual Studio 2003, Visual Studio 2005

Visual Studio 2005, Sharepoint Designer


.NET 1.1, .NET 2.0

.Net 2.0

Master file

Supported in SP2 and developed by VS 2005. The master file stays in the virtual directory of web server.

Master file can be created by Sharepoint Designer and VS 2005. But the master file is a ghost page need to be uploaded via Sharepoint admin page.


CMS Template. It’s stored in template gallery. It contains list of placeholders, list of custom properties and links to a template page (aspx file)

Content Type. Content Type contains a list of columns.

Template page

An aspx page stays on file system.

Page Layout. Created based on the Content Type. Aspx file but stays on Sharepoint server, it’s editable by Sharepoint Designer and VS 2005.

Content place holder

Placeholder. CMS has some build-in placeholders such as html placeholder, xml placeholder, image placeholder and attachment placeholder

Column / Filed. Sharepoint 2007 has more types like single line text, numeric, date, time, currency, html, picture, attachment file… I couldn’t find the xml type which is very useful in current MCMS 2002. But there are a lot other useful column types like lookup, business data …

Place holder control

The build-in placeholder web control used in template aspx page for content editing in authoring mode and content rendering in publishing mode is in Microsoft.ContentManagement.

You are also be able to create your own custom web controls.

Sharepoint 2007 also has many web controls for content editing and rendering. They are in Microsoft. Sharepoint.Publishing. Those controls are automatically added to the page layout aspx when drag the fields in Sharepoint Designer.

I believed you are able to create the custom controls and add to your own page as well.


Posting. Posting will be able to be created and managed in web interface. The posting is stored in CMS database.

Page. Page can be created in Sharepoint admin web UI based on the selected page layout. You are able to use Sharpoint designer to unghost (customize) the page.


Channel. It’s just a simple container contains a set of postings.

Site. It should be an WSS site including a set of lists, doc libraries and other contents.


Resource gallery. No versioning support

Document library, picture library … support versioning

Publishing workflow

Build-in workflow. No alert, hard to customize

Based on Windows workflow framework, very flexible.


Windows AD account only. Only control to channel level

Can control to page level, support AD account, LDAP, and database.



Very good

Sharepoint 2007 also includes other benefits which you couldn’t find in MCMS 2002 out-of-box. For example: the out-of-box navigation bar support, search functions, personalization and user profiles…