Advancing Productivity and Operational Efficiency through Cloud Services and Apps



Just Released – MSDN: Securing Application Pages in Windows SharePoint Services 3.0. By me :)

An article I recently wrote has just been published on MSDN. It covers the basic principles of securing application pages, and why they are often at risk; as well as providing code samples on how to properly secure your application pages, including:

  • How and when to validate page requests
  • How to verify Base Permissions
  • How to verify Role Definitions
  • How to verify Group Memberships

Check it out at: Securing Application Pages in Windows SharePoint Services 3.0 (

Project Planning for SharePoint Implementations

Last week, I presented this topic at the Houston SharePoint Users Group. I really enjoyed giving the presentation, only slightly disappointed that I wasn’t able to attend the technical track which was occurring simultaneously…. I’ll get over it though 🙂

The presentation itself contains a lot of useful information. Thanks to all who provided feedback, and my colleagues at Catapult who helped put it together.

I have uploaded the presentation here

digg_url = “”;digg_title = “Project Planning for SharePoint Implementations”;digg_bgcolor = “#FFFFFF”;digg_skin = “compact”;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

Moving All SharePoint Databases to a New Server

The SharePoint team has released a new procedure on how to move SharePoint databases across servers. Until they are able to do so, it is available in the Microsoft download site at:

There are 2 separate procedures and both can be downloaded on the same page. One for moving databases to a server with the same name, and one for moving databases to a server with a different name.

Remember, This procedure is meant to move “ALL” SharePoint Databases to a new server. However, they are not able to publish it on TechNet at the time.

SharePoint Developer Training – Weekend Crash Course in Houston Texas

I am now offering this same course with Field Advantage Training, the name of the course has been changed to SPDC101 – Core SharePoint 2007 Development. Check us out at for the latest information on upcoming sessions, pricing, and new courses.

This course is designed to cover the most common and critical SharePoint development topics I’ve come to expect from SharePoint implementations, based on several years of experience across multiple industry sectors. The course is meant for experienced .NET developers with entry to mid level SharePoint development experience.

The class will consists of a series of floor discussions and instructor led hands-on labs. The full agenda has been listed below. Attendees will need to bring their own laptops, for which I have posted minimum requirements (see hardware and software requirements below.)

Attendees will receive:

  • An external USB 2.0 Hard Drive with 80 GB or more of storage
  • A Virtual PC image running trial versions of Windows 2003, SharePoint 2007, and Visual Studio (included in the hard drive.)

Course Agenda

Day 1

Core Concepts (8:30 am – 9:45 am)
• Customization vs. Development
• SharePoint Designer
• Visual Studio
• Content Types and Site Columns
• Site Templates and Site Definitions
• Master Pages and Page Layouts
• Features
• Solution Packages

15 minute break

Extending the Out of the Box Experience (10:00 am – 12:00 pm)
Instructor led Hands On Lab
• Creating Custom Content Types
• Customizing the Content Query Web Part
• Connecting to Web Services with the Data Form Web Part
• Customizing Search and People Search Results

1 hour lunch break

Custom Web Part Development (1:30 pm – 2:45 pm)
Instructor led Hands On Lab
• Creating a List Aggregator Web Part

15 minute break

Custom Site Definitions (3:00 pm – 5:00)
Instructor led Hands On Lab
• Creating a Custom Site Definition
• Lists and Libraries
• Provisioning Files into Libraries
• Adding Web Parts and Web Part Pages
• Provisioning Multiple Sites from a Single Template (The Portal Concept)

Day 2

Feature Development and Feature Stapling (8:30 am – 9:45 am)
Presentation and Instructor led Hands on Lab
• Feature Scopes
• Site Features
• Site Collection Features
• Web Application Features
• Farm Features
• Feature Elements
• Feature Receivers
• Creating a Custom Master Page Feature
• Creating a Feature Stapler

15 minute break

Content Types and Event Handlers (10:00 am – 12:00 pm)
Instructor led Hands On Lab
• Developing and Deploying Content Types with Features
• Developing and Registering Event Handlers

1 hour lunch break

Custom Application Pages and Extending the Menu System with Action Items (1:30 pm – 2:45 pm) Instructor led Hands On Lab
• Creating a Custom Application Page
• Adding Menu Items to the Site Actions and Site Settings Menus
• Creating a Custom Administration Page
• Adding Menu Items to Central Administration

15 minute break

SharePoint Solution Packaging and Deployment (3:00 pm – 5:00pm)
Instructor led Hands On Lab
• Packaging Features and Site Definitions
• Packaging Application and Administration Pages
• Assemblies and Safe Control Entries

Hardware and Software Requirements:

  • Laptop computer with a processor speed of at least 2.5 GHz with Hyper Threading or Dual Core Technology
  • RAM capacity of 2 GB minimum (3-4 GB recommended)
    Must be able to allocate a minimum 1 GB of RAM to the Virtual OS
  • Operating System: Windows XP Professional or Windows Vista
  • Additional Software: Adobe Acrobat, Microsoft XPS Viewer

Additional Information:

  • This course is not meant to provide an introduction to SharePoint or the .NET framework. Attendees are expected to have experience with the SharePoint platform as well as .NET development with Visual Studio.
  • Registration will be limited to 20 individuals.
Cost: 550 US dollars per person
(group discount rates available)
Location: Catapult Systems, Houston
10370 Richmond Ave. Suite 1250, Houston, TX 77042

1. Click here to download the registration form
2. Complete registration form and fax toll free to (877) 819-0945
Call 832-472-3648 or e-mail for more information

Please refer to for the latest information.

Microsoft SharePoint Conference 2009 (In Vegas) Open for early registration

Microsoft has just announced the SharePoint Conference 2009 at the Mandalay Bay Events Center in Las Vegas, Nevada on October 19-22, 2009. They are calling it the conference to learn about SharePoint “14”. Go to for more information, including early registration specials.

SharePoint – Architecting for Success

Last week, I gave a presentation on “Architecting for Success” at the SharePoint Technology Conference in San Francisco. It was a subset of full day workshop titled “Success with SharePoint – From Start to Finish”. For those of you interested, I’m making the presentation available for download here. (

Stopping and Restarting WSS 3.0 and Microsoft Office SharePoint 2007 (MOSS)

There isn’t much information out there on the subject (at least not much that I’ve been able to find, and/or consider reliable.) The following steps describe my preferred approach to stop Windows SharePoint Services 3.0 and Microsoft Office SharePoint 2007 (MOSS) in most typical farm environments. It is based on Microsoft’s recommended approach for moving SharePoint related databases.

  1. Shut Down the World Wide Web Publishing Service in the front-end servers to prevent any users from accessing content. You may want to consider Quiescing the farm.
  2. In the Services snap-in on the server(s) running Central Administration, stop the following services:

    Microsoft Single Sign-On service (MOSS only)

    Office Document Conversions Launcher service  (MOSS only)

    Office Document Conversions Load Balancer service (MOSS only)

    Office SharePoint Server Search service (MOSS only)

    Windows SharePoint Services Administration service

    Windows SharePoint Services Search service

    Windows SharePoint Services Timer service

    Windows SharePoint Services Tracing service

    Windows SharePoint Services VSS Writer service

  3. On the server(s) running Central Administration, stop Internet Information Services by opening the command prompt and running iisreset /stop

If restarting the farm, restart the Server Running Central Administration first followed by any application servers and finally the web front end servers.

Please note that the approach may vary from farm to farm based on how its configured, for example: if the Central Administration server is also an application server or front end server, if there are any third party tools or services running on the server, or if the Shared Service Provider is being consumed by any other farms.


Move all databases (Windows SharePoint Services 3.0)
Move all databases (Office SharePoint Server 2007)

Access Denied Error when running STSADM – AddContentDB in a side by side installation of MOSS and SharePoint 2003

This is one of those things that you’ll hardly ever run into. But if the stars are aligned just right, and you are running into this error perhaps this posting will help.

First of all, I’m assuming you’ve already checked the permissions of the account you are using to run this command, and as far as you can tell all the necessary permissions are in place both on the DB Server and the WFE server.

So when are the stars aligned just right?…… If you are running SharePoint 2003 and MOSS 2007 on the same server, each version is configured to use a different database server, and the account you are using to run the command does not have necessary permissions on the SharePoint 2003 database server. Why would you need permissions on the SharePoint 2003 database server, if you are trying to add a content database to your MOSS 2007 Server Farm? Perhaps is a bug, perhaps is a feature, perhaps is by design; I wont pretend to know. But we can make an educated guess by looking at the logs.

Open the logs and look for any errors generated around the same time you ran the command. If you carefully follow the trail of the error you should see some references to the following methods; get_CanUpgrade and ReflexiveCanUpgrade. These will be shortly followed by a connection string to the SharePoint 2003 Database Server, specifically the configuration database. Based on this information we can assume that MOSS wants to check if the content database being added is being upgraded from the SharePoint 2003 configuration. But why does the error occur even when the database is new? Well, MOSS doesn’t yet know that the database is new. Whatever the case may be, the fix is easy; make sure you have the necessary permissions on the SharePoint 2003 database server, or get someone who does to run the command.

BTW, a similar error will occur if adding a content database from Central Administration under the same circumstances.

Apply Site Features Globally from Central Administration via a custom Application Page.

This posting covers a subset of a more general subject; Using Custom Application Pages to Extend the Capabilities of the Central Administration Site. Perhaps I will elaborate on the subject another time. For now, I will cover how to create a custom application page to activate or deactivate site-scoped (web) features globally.

Not much of an explanation is needed in regards to the purpose or practicality of this posting, as I’m sure most of you have been there, but for the sake of being thorough here is a brief description of a problem it helps address:

With just about every SharePoint project I’ve worked on, there has been some level of custom branding, usually involving new themes, master pages, and page layouts. Ultimately, and preferably, these get deployed via site-scoped (web) features. While these features can be automatically activated during the site provisioning process for new sites via Feature Stapling, there are often existing sites that we need to activate the feature on. Activation of these features can generally be narrowed down to specific types of sites, that is sites created from specific templates or site definitions, and generally target specific web applications. Out of the box, SharePoint only allows activation of site scoped features per site via the Site Settings page or stsadmin.exe. Global activation of such features targeting sites of a specific type/definition requires the creation of custom scripts or batch files. The solution; create a custom application page for the Central Administration site that allows farm administrators to activate site features across all sites in a given web application and of a specific site definition.

WARNING: Great care should be taken when applying Features globally. A poorly developed feature, or one that is targeted towards one type of site and applied to another, may render the site inoperable. Make sure you test your features thoroughly with each applicable site definition/template before activating features globally using this or any other technique.

The first step is to create a page that inherits from the GlobalAdminPageBase class, which is in the Microsoft.SharePoint.ApplicationPages.Administration assembly. This is the class that most of your Central Administration Pages should inherit from as it implements security and other related logic with the Central Administration site.

Additionally, you’ll need to include references to the following Namespaces and SharePoint Controls as they will be used throughout the page:

<%@ Register Tagprefix="SharePoint"
Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix="Utilities"
Namespace=”Microsoft.SharePoint.Utilities” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register TagPrefix="wssawc"
Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c”%>

The “Administration” namespace will be used, amongst other things, to obtain a reference to the SharePoint farm. The “Utilities” namespace will be used for security reasons when validating the page request. The “WebControls” namespace and additional “ascx” controls are used in rendering certain controls on the page.

Add the following Content Placeholders for the title, description, and main content area.

    Global Site Feature Management

    Global Site Feature Management

    Use this page to activate or deactivate site-scoped Features across all sites based on the selected site definition for the selected Web Application.

Next we will add an InputForm, ButtonSection, and a WebApplicationSelector controls to the page. This will allow the user to select the Web Application on wish to activate the feature. We use the same controls SharePoint uses on its Central Administration pages to provide a consistent look and feel. We will also add; a RadioButtonList control to display the features, a CheckBox to indicate if the action should be forced, a DropDownList to specify the action (activate or deactivate), and a CheckBoxList to display the Site Definitions. We will encapsulate all of this in an ASP Panel control to toggle the visibility of the form when the user clicks OK.







            <!– ****************************************
                 USING THE InputFormSecton AND ASP:RadioButtonList CONTROLS –>
            <wssuc:InputFormSection runat="server"
                Title=”Site Feature”
                Description=”Select a site feature from the list” >




            <!– *******************************************
                 PERFORM WITH THE FEATURE–>
            <wssuc:InputFormSection runat="server"
                Description=”Specify if activating or deactivating the selected Feature.” >




            <!– *******************************************
                 SHOULD BE FORCED –>
            <wssuc:InputFormSection runat="server"
                Title=”Force Feature Activation / Deactivation”
                Description=”Check here to force feature activation or deactivation.” >




            <!– *******************************************
                 USING THE InputFormSecton AND ASP:CheckBoxList CONTROLS –>
            <wssuc:InputFormSection runat="server"
                Title=”Site Definitions”
                Description=”Select the site definitions to which the
                                 feature will be applied” >




            <!– ****************************
                 OK AND CANCEL BUTTON SECTION –>
            <wssuc:ButtonSection runat="server" TopButtons="false" 
                BottomSpacing=”5″ ShowSectionLine=”true”>
                    <asp:Button UseSubmitBehavior="false" runat="server"
                       class=”ms-ButtonHeightWidth” OnClick=”BtnSubmit_Click”



            <!– *****************************************
                 USE SHAREPOINT THE ButtonSection CONTROL
                 TO DISPLAY THE “OK” AND “CANCEL” BUTTONS –>
            <wssuc:ButtonSection runat="server" TopButtons="true"
                BottomSpacing=”5″ ShowSectionLine=”false”>
                    <asp:Button UseSubmitBehavior="false" runat="server"
                        class=”ms-ButtonHeightWidth” OnClick=”BtnSubmit_Click”

            <!– **************************************
                 USING THE InputFormSecton AND WebApplicationSelector CONTROLS.
                 THEMSELVES ARE PLACED INSIDE THE InputFormControl SECTION –>

            <wssuc:InputFormSection runat="server"
                Title=”Web Application”
                Description=”Select a Web Application” >

                    <SharePoint:WebApplicationSelector id="Selector" runat="server"
                            AllowAdministrationWebApplication=”true” />
                    <!– Use a SharePoint Required Field Validator to ensure
                         that a web application is selected –>
                            ErrorMessage=”You must select a Feature to activate”
                            Runat=”server” />
                    <asp:RadioButtonList ID="rdSiteFeatures" runat="server"
                            CssClass=”ms-listheaderlabel” EnableViewState=”true” />
                    <asp:DropDownList ID="lstAction" runat="server"
                    <asp:CheckBox ID="chkForce" runat="server" 
                          EnableViewState=”true” Text=”Force
                          CssClass=”ms-listheaderlabel”  />
                       <asp:CheckBox ID="chkSelectAll" runat="server"
                            Text=”Select All
Click here to select all site
                            AutoPostBack=”true”  />

                        <asp:CheckBoxList ID="chkListSiteDefinitions" runat="server"
                            CssClass=”ms-listheaderlabel” AutoPostBack=”false” />



Next we’ll need to populate the list of features. Check the PostBack state of the page, if false, get the available features from the FeatureDefinitions property of the SPFarm object. Iterate through each of the features and add a list item the the feature radio button list for each one that is scoped at the site(web) level.

//Get the regional localeID and Culture Information (Regional Settings)
//these will be used to retrieve the list of features and
//site definitions
int localeID = (int)SPContext.Current.RegionalSettings.LocaleId;
System.Globalization.CultureInfo cInfo = new System.Globalization.CultureInfo(localeID);

//Get a reference to the farm object we will use it
//to retrieve the feature definitions
SPFarm thisFarm = SPFarm.Local;
foreach (SPFeatureDefinition featureDefinition in thisFarm.FeatureDefinitions)
//Check that each feature is scoped at the web level and
//that it is not hidden before adding it to the list
if ((featureDefinition.Scope == SPFeatureScope.Web) && !(featureDefinition.Hidden))
ListItem siteFeatureItem = new ListItem("" + featureDefinition.GetTitle(cInfo) + "
+ featureDefinition.GetDescription(cInfo), featureDefinition.Id.ToString());

To populate the list of site definitions obtain a reference to the SPWebTemplateCollection of the current site definition via the GetWebTemplates method.

//Get the list of available Site Definitions / WebTemplates
foreach (SPWebTemplate webTemplate in SPContext.Current.Site.GetWebTemplates(SPContext.Current.RegionalSettings.LocaleId))
//Skip "GLOBAL", it has an ID of 0
if (webTemplate.ID != 0)
ListItem webTemplateItem = new ListItem("" + webTemplate.Title + " - ID: " + webTemplate.ID + " Name: " + webTemplate.Name + "
+ webTemplate.Description,webTemplate.Name);

Finally, you’ll need to write the code that adds or removes the feature from each site. Use the CurrentItem of WebApplicationSelector to get a reference to the selected web application and the underlying site collections. Iterate through each site(web) checking the WebTemplate and Configuration properties of each against the list of selected site definitions. If the web template and configuration of the site are in the list of selected site definitions, call the Add method of SPWeb.Features to activate the feature and the Remove method to deactivate it based on the “action” the user selected.

// This method is called when the user clicks the "OK" button
// to activate the site feature.
protected void BtnSubmit_Click(object sender, EventArgs e)
//Prepare a string object to display the result
//of the feature activation for each site
string strMessages = "";

//Hide the form
inputForm.Visible = false;

//Get the GUID of the selected Feature to activate
Guid featureID = new Guid(rdSiteFeatures.SelectedValue);

//Iterate through each of the site collections
//in the selected web applications
foreach (SPSite site in Selector.CurrentItem.Sites)
//Disable the CatchAccessDeniedException
//of the site collection to avoid being redirected
//to the "Access Denied" page if access is denied.
site.CatchAccessDeniedException = false;

//Iterate through each site in the site collection
//and activate the selected feature
foreach (SPWeb web in site.AllWebs)
//Use a try statement to trap any errors that
//may occur during activation. Errors may occur
//due to feature dependencies, features that
//may already be active, permissions, etc.
//Consider Refactoring this code for better error
//Check if the site definition/configuration of the
//current site is included in the list of site definitions
//that the feature will be applied to.
ListItem item = chkListSiteDefinitions.Items.FindByValue(web.WebTemplate + "#" + web.Configuration.ToString());
if ((item != null) & (item.Selected))
//Activate the feature
if (lstAction.SelectedValue == "Activate")
web.Features.Add(featureID, chkForce.Checked);
strMessages += "
Feature Successfully Activated: "
+ web.Url + "
web.Features.Remove(featureID, chkForce.Checked);
strMessages += "
Feature Successfully Deactivated: "
+ web.Url + "

catch (Exception featureActivationError)
//if an error occurs during activation;
//capture the message to display it to the user
//after iterating through all the sites
strMessages += "
Feature Activation Error: "
+ web.Url + " ERROR:" + featureActivationError.Message + "
//Allow the site collection to continue handling
//access denied exceptions
site.CatchAccessDeniedException = true;
catch (Exception featureActivationError)
//if an error occurs write the error message to
//an error element
strMessages += featureActivationError.Message + "hhhhhh

Save the application page to the “ADMIN” folder in the 12 hive’s template directory, usually C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ADMIN\. The complete code sample of the application page includes additional error handling and security logic to validate the users roles and page request.
With the application page created and saved to the ADMIN folder, it can be called and ran from the browser via the Central Administration site’s URL followed by “_admin/pagename.aspx” (i.e. http://centraladminsite/_admin/sitefeaturemanagement.aspx).
To add a link to the page from the Application Management Section of the Central Administration Web Site, we’ll need to create a farm feature. Create a new folder in the feature directory and name it “SiteFeatureAdministration”. Create a Feature.xml file in the newly created folder with the following code:

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns=""
Title="Site Scoped Feature Management"

<ElementManifest Location="Elements.xml" />

This file tells SharePoint that the feature is scoped at the farm level and is to be activated by default. The elements.xml file referenced will contain the instructions of what the feature should do.
Next create an elements.xml file in the SiteFeatureAdministration folder with the following code:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="">
Title="Site Scoped Feature Management"
<UrlAction Url="_admin/SiteFeatureManagement.aspx"/>

The “CustomActionGroup” element tells SharePoint to create a new section titled “Utilities” in the Application Management Section of the Central Administration site. The “CustomAction” element gives the link a name and adds it to the CustomActionGroup. The “UrlAction” element specifies the URL of the link.
Deploy the feature using your preferred method. Go to the Application Management page in the Central Administration, you should see the Utilities Section with a link to the Site Feature Management page.
When creating custom solutions for SharePoint its always a good idea to use Solution Packages. They provide ease of deployment and upgrading capabilities for your custom application pages, features, web parts, and custom site definitions to all of the servers in the farm. For more information on how to create, deploy, and work with solution packages, reference:
You can download the full code samples from:
You can download the solution package from:

Blog at

Up ↑

%d bloggers like this: