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 (www.hatchsolutions.co.uk) 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=”info@hatchsolutions.co.uk” 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;
https://www.hatchsolutions.co.uk/Pages/ContactUs.aspx

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 (https://community.office365.com/en-us/f/153/p/8015/34893.aspx#34893). 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
e.g. https://martinhatch-web.sharepoint.com/_layouts/settings.aspx

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 🙂

STEP 4 – CLEANUP?
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.

[Update]
Note – I have started a forum thread asking this specific question. We shall see !!
https://community.office365.com/en-us/f/153/p/8015/33059.aspx#33059
[/Update]

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: https://ckssandbox.codeplex.com/

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 martinhatch.com

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 blogger.com 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 (https://www.hatchsolutions.co.uk/) 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!

cheers

Martin

Page Title element and PerformancePoint Report always being blank

This was one I came across recently while doing some custom branding work on a SharePoint 2010 site which was using Performance Point Services, and specifically the PerformancePoint Report Web Part.

I had a simple branded master page (which was a copy of the normal v4.master) but could not for the life of me get PerformancePoint reports to work.

The Report Web Part was blank (with zero height) and there was a JavaScript error on the page:

Unterminated string constant
Code: 0

Well .. I rolled my site back to the v4.master and it was working again. I copy-pasted the v4.master <head> contents into my custom master page and it started working again .. although when I double checked the contents they were IDENTICAL.

So far this was very very weird .. and the actual solution is even weirder.

It seems it was to do with my <title> element in the <head> tags being broken onto separate lines:

BAD
<title>
   <asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server” />
</title>

GOOD
<title><asp:ContentPlaceHolder id=”PlaceHolderPageTitle” runat=”server” /></title>

Why?? I have no idea .. but making this simple change solved the problem.
Bizarre eh?

Visual Studio 2010 and Unlimited Test Users!

This one came a bit out of the blue, which I found while reading Chris O’Brien’s excellent article on Optimising SharePoint 2010 Internet Sites.

It basically mentioned the new Microsoft initiative where

“active Visual Studio Ultimate with MSDN subscribers are provided a license key to generate UNLIMITED virtual users without having to purchase the Visual Studio Load Test Virtual User Pack 2010.”

This is fantastic news, as previously that “Load Test Virtual User Pack” cost around £4000 per license and only added 1000 users at a time (this is on top of the already expensive £12,000 odd Visual Studio Ultimate license!!)

Note – all prices are approximate (read .. in my head)

More details can be found at the Microsoft article:

Visual Studio 2010 Load Test Feature Pack and Visual Studio Load Test Virtual User Pack 2010 Frequently Asked Questions (FAQ)

Attending SPRetreat #2 :)

Well, I snuck in last minute, but I’m managed to book myself a place at the March 2011 SPRetreat London session (Saturday March 5th).

This is the second SPRetreat, and once again joins Andrew Woodward (@AndrewWoody) as the expert in Unit Testing, Test Driven Development and usage of TypeMock Isolator with SharePoint development techniques.

https://spretreatlondon11.eventbrite.com/

Big thanks to:
 
Wes Hackett for organising and Content and Code for sponsoring the venue.
 
Typemock for providing a great product (Isolator) and for donating 2 full licenses as prizes worth almost £1,000
 
21apps for organising and providing the food.
 
Really looking forward to this 🙂

Now an MCPD in SharePoint 2010!

Well, I had a few days spare as my new contract hadn’t started so was pondering what to do, and decided to sit the two developer based SharePoint 2010 Exams.

There are two of them in the new development based certification track for SharePoint:

The first exam will grant you an Microsoft Certified Technology Specialist and the second one the new Microsoft Certified Professional Developer.

I am very pleased to report that I passed both exams (yay me!) and can now proudly sport my new certification logos:

Microsoft Community Contributor Award 2011

Well, I got a very nice surprise today as I have been awarded the Microsoft Community Contributor Award for 2011.

This is an award given to people to “recognize notable contributions to Microsoft online community forums such as TechNet, MSDN®, and Answers”.

For those not aware there are fantastic SharePoint forums on MSDN (https://social.technet.microsoft.com/Forums/en-US/category/sharepoint2010) and I can typically be found browsing the Development forum, answering the odd question here and there, so I am well chuffed to be recognised in such a way.

As well as my funky new logo / badge (below) I have also been awarded a Safari Books subscription for over 400 online Microsoft Press books! 🙂 Which is extremely awesome.

So thank you to whomever put me forward for this, thanks to Microsoft for the recognition (and the prize) and thanks to the SharePoint community in general for making this product (and the community itself) so brilliant in itself!

« Older Entries Recent Entries »