Intro:
SharePoint is a great product to
use, if you know how to leverage it properly.
Thousands of companies out there that use
SharePoint sadly miss out on some of the great
quirks that SharePoint has to offer. One of my
favourite ones is the ability to generate an
entire portal structure on the fly. Not only
does this save you time in the painstaking
process of making sites and subsites (and
assigning the right templates to them), but it
also provides a clean structure which you can
revisit at any time for restructuring or
redesign purposes with little
effort.
Step
1: Design it
Do a high-level design of your
portal's structure based on what you (or client)
needs, list all your main sites, and the
subsites, and determine who'll have access to
using the different sections and on what
content. As an example, we'll set up our portal
the following way.
1 Home
2 -Services (For all
users)
3 -Employees (For users of type
Employee)
--TeamBlogs
--KnowledgeBase
4 -Clients (For users of type
Client)
--Projects
--Announcements
--Stakeholders
5 -About (For all
users)

This is our portal structure,
notice that under the Employees and Client
subsites, I'm creating specific subsites that
will cater to the type of user that's logged in
to my portal (If you want to read more on how to
manage site groups and permissions, read this
article: "Managing Site Groups and
Permissions" http://office.microsoft.com/en-us/winsharepointadmin/HA011608101033.aspx).
Step
2: Manifest it.
Create the following file:
Your project SharePoint (AKA 12
Hive)\Template\SiteTemplates\RMSIManifest\RMSIPortalHomeManifest.xml
<?xml version="1.0"
encoding="utf-8" ?>
<portal
xmlns="PortalTemplate.xsd">
<web name="Home"
siteDefinition="RMSIHome#1" displayName="Home"
description="RMSI Portal
Manifest">
<webs>
<web name="Services"
siteDefinition="RMSIHome#2"
displayName="Services" description="Services
sub-site (List of our services, public
announcements, etc)"
/>
<web name="Employees"
siteDefinition="RMSIHome#3"
displayName="Employees" description="Employees
Sub-Site (tailored to each employee)"
>
<webs>
<web name="TeamBlogs"
siteDefinition="BLOG#0" displayName="Team Blogs"
description="Blog Site containing personal and
technical blog postings from team members."
/>
<web name="KnowledgeBase"
siteDefinition="WIKI#0" displayName="Knowledge
Base" description="Wiki Site containing
orientation literature and SharePoint related
technical posts from team members."
/>
</webs>
</web>
<web name="Clients"
siteDefinition="RMSIHome#4"
displayName="Clients" description="Clients
Sub-Site (tailored to each
client)">
<webs>
<web name="Projects"
siteDefinition="STS#0" displayName="Projects"
description="Team Site containing list of client
projects, timelines, scheduled meetings, etc."
/>
<web name="Announcements"
siteDefinition="STS#0"
displayName="Announcements" description="Team
Site containing Project Announcements, including
new projects and completed projects."
/>
<web name="Stakeholders"
siteDefinition="STS#0"
displayName="Stakeholders" description="Team
Site containing Project Stakeholders, including
client contacts and team members assigned."
/>
</webs>
</web>
<web name="About"
siteDefinition="RMSIHome#5" displayName="About"
description="About Sub-Site (Who We Are, Core
values, the leadership team, careers, contact
page)" />
</webs>
</web>
</portal>
In this case, for the bottom-level
subsites (like Employees/Orientation, or
Clients/Projects), I'm using OOTB (Out Of The
Box) site templates (like "STS#0", which is the
SharePoint Team collaboration site template).
By the way, you MUST have the
following URL bookmarked;
“List of Out of Box (OOB) Site
Templates”
http://blumenthalit.net/blog/Lists/Posts/Post.aspx?List=35b60df2-0af2-4e52-8c6f-d3a64a542f45&ID=45
In all other cases, I'm using a
custom site definition marked with my portal's
home site definition prefix (RMSIHome) followed
by a numeric identifier. Note that this is not
necessary, you're better off using the OOTB site
templates since they usually have what you would
normally need. But if you would rather create a
custom site definition rather than use a basic
Publishing site, then follow this article
through including Step 4.
If you want to read more on this
discussion (the cons of creating custom site
definitions), read: "Andrew Connell's post
on Site Definitions" http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx
Step 3: Define
it.
Create the following "WEBTEMP"
file:
*12
Hive*\Template\1033\XML\webtemp.RMSIPortal.xml
<?xml version="1.0"
encoding="utf-8" ?>
<Templates xmlns:ows="Microsoft
SharePoint">
<Template
Name="RMSIPortal"
ID="10010">
<Configuration
ID="1"
Title="RMSI
Portal"
Description="RMSI Intranet Home
Web"
ImageUrl="/_layouts/images/blankprev.png"
RootWebOnly="TRUE"
Hidden="FALSE"
DisplayCategory="RMSI"
ProvisionAssembly="Microsoft.SharePoint.Publishing,
Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c"
ProvisionClass="Microsoft.SharePoint.Publishing.PortalProvisioningProvider"
ProvisionData="SiteTemplates\\RMSIManifest\\RMSIPortalHomeManifest.xml"
/>
</Template>
</Templates>
Notice that we're leveraging the
"PortalProvisioningProvider" (which implements
SPWebProvisioningProvider), this takes the data
found in "RMSIPortalHomeManifest.xml" from Step
1, and generates a portal structure based on
that information. If you want exact details on
the properties I used in the above example, read
this article: http://blogs.technet.com/apurdon/default.aspx
Important! I've run into the
problem where I was in an infinite loop and
produced a vague "Stack Overflow" error. Took me
a while to figure out that the reason was
because I was using the same name in my Portal
template (above) as in the site template
"RMSIHome" (below) so save yourself some
trouble, and ensure that they're different as
we're doing here (in this case, I've named my
template "RMSIPortal").
Step
4 (optional): Site-Define it!
This step is only needed if you're
creating custom site definitions, so if all
you're using are OOTB templates like STS#0, you
can skip this step.
Under SiteTemplates, create a
folder called RMSIHome (this HAS to match your
siteDefinition name prefix designated in your
manifest file). In this folder, you will set up
an ONET.xml file (which stands for an Office
.NET file). You can reuse one of the OOTB Site
Templates for this from this location:
c:\Program Files\Common Files\Microsoft
Shared\web server
extensions\12\TEMPLATE\SiteTemplates
Now, your file will contain all
your site definitions indicated in Step 2, with
the features used in each one of them,
i.e.:
<Configurations>
<!-- Home
-->
<Configuration ID="1" Name="Home"
CustomMasterUrl="_catalogs/masterpage/YourIntranet.master">
<SiteFeatures>
<!-- In here you will include any
custom or OOTB Site Features
-->
<!-- BasicWebParts Feature
-->
<Feature
ID="00BFEA71-1C5E-4A24-B310-BA51C3EB7A57"
/>
<!-- Three-state Workflow Feature
-->
<Feature
ID="FDE5D850-671E-4143-950A-87B473922DC7"
/>
....
</SiteFeatures>
<WebFeatures>
<!-- In here you will include any
custom or OOTB Web Features
-->
<!-- TeamCollab Feature
-->
<Feature
ID="00BFEA71-4EA5-48D4-A4AD-7EA5C011ABE5"
/>
<!-- MobilityRedirect Feature
-->
<Feature
ID="F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"
/>
...
</WebFeatures>
</Configuration>
<!--
Welcome -->
<Configuration ID="2" Name="Welcome"
CustomMasterUrl="/_catalogs/masterpage/YourIntranet.master">
...
</Configuration>
<!--
Employees -->
<Configuration ID="3" Name="Employees"
CustomMasterUrl="/_catalogs/masterpage/YourIntranet.master">
...
</Configuration>
<!-- Client
-->
<Configuration ID="4" Name="Client"
CustomMasterUrl="/_catalogs/masterpage/YourIntranet.master">
...
</Configuration>
<!-- About
-->
<Configuration ID="5" Name="About"
CustomMasterUrl="/_catalogs/masterpage/YourIntranet.master">
...
</Configuration>
</Configurations>
Notes:
What is Three-State
Workflow?
This feature is used to
track the status of a list item in three phases.
As per the article below, "it can be used to
manage business processes that require
organizations to track a high volume of issues
or items, such as customer support issues, sales
leads, or project tasks."
More info: "Use a
Three-state workflow" http://office.microsoft.com/en-us/help/HA101544311033.aspx
What is a TeamCollab
Feature?
This tells your site how
to activate certain features that define the
collaboration lists and libraries in a given
"Team Collaboration" Site.
What is the
MobilityRedirect Feature?
This feature allows you
to support pocket PC and other PDA browsers by
taking them to a customized "/m/default.aspx"
page in your site. If you think mobility would
be useful for your site, read this: "Custom
Mobility Pages for SharePoint" http://www.iwkid.com/blog/Lists/Posts/Post.aspx?ID=36
For a list of all Farm,
Site and Web Features in MOSS 2007 and their
GUID's, check this link:
"List of Features with
GUIDs" http://www.thorprojects.com/blog/archive/2007/05/16/list-of-features-with-guids.aspx
Step 4: Deploy
it!
That's
it! Go ahead and build to make sure there are no
build errors, then do an IISReset (or just reset
the app pool that your site collection is
running under, this is usually faster).
Now,
depending on the way you have your
project set up, you can either have
the portal provision as part of your
deployment script, or do it manually in Central
Admin (after you deploy it), at the "Create Site
Collection" option in the "Application
Management" tab (note that the site
template will only show up in the list of
templates if you have the property
HIDDEN=FALSE, in
webtemp.RMSIPortal.xml).
And by
the way, if you aren't using the SharePoint
Solutions Package Creation Tool (WSPBuilder),
you should: http://www.codeplex.com/wspbuilder
Signing
off!
Salem
Al-Tamimi
SharePoint Consultant
RapidMind
Solutions
Inc.