Monthly Archives: July 2011

How to add the “Contact Us” gadget to your Office 365 Publishing Site

This follows on from my previous post which describes how to enable the Publishing Features for your Office 365 website and resolving issues with Custom Master Pages in Office 365.

Having done that on my own site ( I found that one of the key “Gadgets” was missing .. the Contact Us form.

This was an immediate conundrum.. Sandbox Solutions do not allow email access so I knew I couldn’t use that as an out, so I thought I would hunt down that Gadget.

STEP 1 – Add Office 365 namespaces to your Custom Master Page
This is a pre-requisite, as you will be using some of the “Office 365” web controls. I found these in the header of the “oob” root.master which you will find in the All Files section of your public website in SharePoint Designer.

Add these to the top of your Custom Master Page.

<%@ Import namespace=”Microsoft.SharePoint.Spx.WebSite.Controls” %>
<%@ Import namespace=”Microsoft.SharePoint.Spx.WebsiteCore” %>
<%@ Import namespace=”Microsoft.SharePoint.Spx.WebsiteCore.Controls” %>

(note the special Microsoft.SharePoint.Spx namespace!)

STEP 2 – Create Custom Page Layout with Contact Us Control Embedded
This was the way I chose to do it .. you don’t have to do the same (although I couldn’t work out an easier way of doing this myself).

I created a new custom Page Layout (based from one of the others). I deliberately removed any references to any custom code-behind or code-blocks.

This means that I will be running OOB code, and won’t be consuming any Sandbox Resource points!

Then add the following ASP.Net snippet into your page:

<iws:ContactUsControl runat=”server” EmailTo=”” CultureName=”en-US” SendToBCM=”on” xmlns:iws=”iws” />

This is the same ASP.Net tags that get used when you drop the gadget onto your page.
You can see in my example I have added my own EmailTo and CultureName attributes .. you can set these to whatever is appropriate.

The other thing to note is that you must place this control in an EditModePanel with PageDisplayMode=”Display”. The Contact Us form otherwise tries to validate the page when you try and Save Changes or Publish (not good!)

And that is it .. simply save your changes, publish your page layout and create your own page! 🙂
I have created my own custom page layout here;

Please let me know how you get on with yours!

Office 365: Custom Master Page – Resolving “Code blocks are not allowed in this file”

This was an annoying error for quite some time. Office 365 (SharePoint Online) gives you full control to create, deploy and select custom master pages, but if you try using them you often get the error:

Code blocks are not allowed in this file

The reason for this is because of the locked down security permissions in the Master Page Gallery. This is fair enough, just means you can’t have custom code running on your Master Page (but seriously .. how often do you actually need to do that?)

So .. I created my Master Page using the awesome CodePlex Starter Master Pages. And this was fine until I deployed it (using Sandbox Solutions) to my Office 365. Bam .. error message (Code blocks are not .. blah blah).

Well .. I went through my Master Page line by line .. I couldn’t actually FIND any code blocks. I could find a bunch of expressions (but these don’t count!) such as

  • <%@ Import %>
  • <%@ Register %>
  • <%$Resource ..>

The Resource tags reference resource strings. This is used ALL over the OOB controls and is generally very good practice!

I finally worked out what was causing it .. the actual Master page tag itself!
    <%@ Master language=”C#” %>

The “language” attribute was causing all of the problems! (even though we didn’t have any code!)

So I removed the language attribute (leaving me with):

    <%@ Master  %>

And hurrah! I all started working. Hope this helps! Happy branding!

How to configure your Office365 public website to use the SharePoint Publishing Infrastructure

Important Update (2nd September 2011) – Microsoft have announced that this is NOT SUPPORTED. Please see the following post: Update – Publishing Features “not supported” on Office 365 Public Websites

This is something that has bugged me for a LONG time .. I cannot possibly understand why SharePoint Online (with one of the most powerful Web Content Management Systems) was so thoroughly limited by cutting back to a really basic template editor. I can only think of 2 reasons:

  1. Microsoft assumes the average user won’t know how to use SharePoint, so wanted to provide a simpler user interface. This is fair enough, and if this IS the reason there should be no reason why I can’t go “behind the scenes” and setup the site any way I like (at my own risk .. as it were).
  2. Microsoft is trying to protect revenue from “SharePoint 2010 Server Internet Facing Sites” licenses. These are VERY expensive and a lot of companies will happily get rid of their on-premise install to put in a £80 a year Office 365 E1 plan to host their website.

Now .. if it is case (1) then we should be good to go. If it is case (2) then they probably have terms and conditions specifically stopping someone from doing this… so first off lets get the disclaimer out of the way 🙂

Disclaimer Update (26th July 2011) – I have received confirmation from Microsoft via the Office 365 community site that this IS ALLOWED ( Having said that if you decide to do this in your own environment then proceed at your own risk! If something goes wrong it is NOT my fault .. you have been warned!

Ok .. now that is dealt with lets get on with it!
The first thing I want to note is that this is only possible using an Enterprise Plan. If you are using the Small Business version of Office 365 (such as Plan P1) then you won’t be able to do this for 2 major reasons:

1) SharePoint Designer blocks access to “All Files” so you can’t make some of the changes we need to do.
2) You don’t have access to Site Collection Features, so you can’t activate the Publishing Infrastructure Feature!

So I setup my own trial Enterprise Plan (with a 30 day expiry .. hence why I haven’t bothered posting the URL) and created the standard “Public Website” site collection… then what?

STEP 1 – SharePoint Designer – Rename the Public Website Folders
This is the first fundamental step. If you don’t do this then STEP 2 will throw errors at you (because folders using “Pages” for example, already exists!).

Open your site in SharePoint Designer 2010 (free download) and click on “All Files” (should be the bottom link in the left-hand navigation panel).

This will show you the URL paths being used by each of the lists and libraries. You cannot delete these (as the delete option is prohibited) but you can rename them!
RENAME each of the following libraries (I have prefixed mine with OLD).

  • Documents
  • Images (the root folder)
  • Pages
  • SiteImages (the library)
  • TemplateGallery

None of these will be required once you have activated the publishing features.

Next, go to “Lists and Libraries” (second link from top left hand side). This will show you the NAME of the same lists and libraries.
RENAME each of the following libraries (again, I have prefixed mine with OLD).

  • Documents
  • Web Pages
  • Templates
  • Images

 Your site is now primed for the publishing features to be activated (if you navigate to your website URL now, you would be taken to the blank “default.aspx” page).

STEP 2 – Activate Publishing Features
Navigate to your website and append “/_layouts/settings.aspx” onto the end

You will need to activate 2 features in this order:

  1. Site Collection Features – SharePoint Server Publishing Infrastructure
  2. Site Features – SharePoint Server Publishing

So you now have “publishing” functions available!

STEP 3 – Create default Page
This is really optional, and anyone familiar with SharePoint should be happy from this point onwards.

  • New Page is now available from Site Actions. This will create a new Publishing Page
  • Using the Master Page options in Site Settings change the Site Master Page (I have used NightandDay.master in the screenshot below). You can of course create and deploy your own custom master pages using either SharePoint Designer or Sandbox Solutions.
  • Advanced Navigation options are now available from Site Settings.
  • The Pages library supports Content Approval, Publishing workflows and scheduling!

And that is it .. all done 🙂

The only problem with this is we now have a bunch of old libraries hanging around which we can’t get rid of.
I’m sure there is a neat way using a Sandbox Solution or client object model to delete those forcibly, and setup all of this, but for now I’m putting up with a bunch of old libraries prefixed with “OLD” (which don’t contain anything).
The other thing in the mean time is finding out if Microsoft are actually willing to let us do this? I really hope they are .. it does expose the awesome power of SharePoint to the masses .. but will it mean they sacrifice some of the on-premise installs?? fingers and toes remain crossed.

Note – I have started a forum thread asking this specific question. We shall see !!

CKS:Sandbox 1.0 is now live!

For those who haven’t heard I started this project off a few weeks ago because I was frustrated with the complete and utter lack for any meaningful Sandbox Solution management in SharePoint 2010. Well, the fruits of my labours are now complete and the first major version of the CKS: Sandbox Tools Edition has now been launched!

If you want to download CKS:Sandbox, are looking for more information including install instructions, screenshots or documentation about how it works, then go visit our site:

What does CKS:Sandbox actually do?
Well, its main function is as a large library of Solution Validators. All of the source code is available (through CodePlex). The tool kit itself contains loads of goodies which are listed below:

CKS:Sandbox Version 1.0 includes the following functionality:

Validation Functionality
The highly configurable validation engine runs using SharePoint Solution Validators. This allows you to customise a set of rules that are checked each time someone tries to Activate a sandbox solution anywhere in the SharePoint Farm.

  • Fully configurable Validation Rules allowing you to check Sandbox Solution Packages for:
    • Validate specific solutions using their unique Solution ID
    • Assembly Public Key Tokens to only allow specific SNK files to be used during development
    • Assembly names using wildcard matching.
    • You can validate the Type Namespaces for each type in the assembly, using wildcard matching, such as “Microsoft.SharePoint.*
    • You can specify Blocked File Types by file extension (such as JS or XAML)
    • You can validate the content of each file in the solution using RegEx or Wildcard matching (such as blocking <script> tags)
  • You can set the default Validation Behaviour allowing you to Allow All or Block All for the different Validation Rule types
  • You can enable / disable Enforce Validation and choose whether to block solutions when a solution fails validation

Error Mesages and Emails

  • You can enable / disable Email Notification and receive emails to a configurable email address when a solution fails validation
  • Standard “CKS” error messages and pages are provided with the tool and displayed to end users if a solution is blocked during activation
    • You can use your own custom error messages by providing a URL to your own ASPX pages

Admin Tools

  • The Manage Sandbox Solutions page allows you to view every single Sandbox Solution currently installed in your farm;
    • Grouped by Site Collection, showing the Name, URL and current Resource Point Quota
    • Provides a link to the Site Collection Solution Gallery where it is stored
    • Shows the Solution ID, Title and Description information
    • Shows the Activation status of each Solution, and how many Resource Points it has currently consumed.

Finally a quick thank you Wes Hackett, of the CKS:Dev team, for the CKS introduction!

New look and feel for

Well, its that time of year I suppose. I finally got around to giving my blog a bit of a freshen up.
It’s nothing too fancy .. a simple and clean white/grey style which is hopefully a little easier on the eye than my old red one (which I suppose was really a throw-back from my days working at Content and Code .. when everything we produced was a shade of red – their corporate colours).

What  else have I changed?

The main thing is the width has been increased from the downright lousy 740px width (an old template I originally used) and up to a much more healthy 990px (which should be suitable for pretty much all modern browsers running 1024×768 or higher).
[Edit]It was set to 1000px, but this was causing horizontal scrollbars, so I made it 10px thinner[/blog]

I’ve also moved some of the navigation elements around, hopefully it makes it easier for you to find things, and there is a navigation bar at the top (which currently just consists of a “Blog” and “About Me” links but it was taking up too much real-estate on the right-hand side).

I also have a brand spanking new logo header. This was a bit of a cheeky freeby from fellow tweeter Dave Coleman. His son (also on twitter as CommandoUK) is starting up as a graphics designer and was offering some free blog / website headers to get his portfolio up and running.

Well, I was interested and he knocked up the logo header you see on there today 🙂 I like it quite a lot .. it oncorporates the main logo from my company site ( as well as some funky colours which happen to mimic my Alienware M15X laptop colours (yeh … I know .. it’s a gimicky laptop which allows you to change the colour scheme of the keyboard and stuff ..)

Anyway, let me know if you like it (or not I suppose!). Thanks for visiting and hope you enjoy my next few posts.

Got more CKS: Sandbox stuff coming up, some Office 365 stuff and probably some SharePoint BI posts on the way too!