Tag Archives: Office 365 Grid

Why I’m loving having my head in the Microsoft cloud

Microsoft Disclaimer – Yes I am a Microsoft evangelist. I have been working with Microsoft tech for the entire of my working career. I know there are competing technologies out there, some of them perhaps more feature rich, or cheaper, or whatever .. but this is merely a conversational piece about my experience which I still believe is the ONLY supplier you can go to in order to get the complete service across all scenarios from the same supplier … please don’t troll, we don’t feed them here!

I have to admit up front .. I have never really been what you might call an “early adopter”. I didn’t get my first mobile phone until 2001.. Everyone I knew was using laptops for years while I got my first one for myself in 2010, and until recently all of my backups have been to portable disk drives sat in the drawer of my office at home.

Things have changed though .. life is different and a whole lot easier .. I’m moved all of my stuff to “the cloud” just over a year back, and my cloud has a Microsoft logo!

Terminology Disclaimer – Yes, I know .. “The Cloud” .. we used to just call these things Data Centres or 3rd Party Hosting. But you gotta keep with the times eh!

Cloud Services
So .. when I’m talking about “moving to the cloud” what exactly am I referring to? Well .. I’ve split this into two sections; Personal Use and Business Use.

  • Personal Use
    • Email (Hotmail)
    • Personal file storage (SkyDrive)
    • Sync between phone and desktop (Windows Phone)

  • Business Use
    • Email (Office 365 – Exchange Online)
    • Document Storage (Office 365 – SharePoint Online)
    • Collaborative workspaces (can’t believe I’m actually using this phrase.. sorry!) (Office 365 – SharePoint Online)
    • Instant Messaging / Video Conferencing / Desktop Sharing (Office 365 – Lync Online)
    • Development Source Control (Team Foundation Service)

… and I could get all of this for £107 per year …

Personal Use – Email (free)
I guess with this I’ve been a “cloud” user for quite some time. I’ve actually had my Hotmail account for over 16 years (1997 .. shortly after it was purchased by Microsoft). Ok .. so back in my youth I needed an email address and this was going through school as being the “cool new thing” so I signed up (didn’t really use it much for the first couple of years though).

That effectively took care of my personal email needs, and 16 years later I’m still using the same email address (and thanks to the pretty damned awesome junk mail filtering Microsoft have in place, I get very little spam at all, if any!).

Personal Use – File Storage (£32 per year)
So the next thing I was going to look for was personal file storage.. fast forward about a decade and my email account also led me to, of course, SkyDrive. Now this service has been around since 2007 and I got it “for free” because of my Hotmail account. Things really started to get interesting when LiveMesh was launched (the beta coming out in 2008) which allowed you to start syncing files on your workstation with your SkyDrive account.

However .. LiveMesh was quite limited as it would only sync a maximum of 5GB of files to the cloud (regardless of how much free space you had .. I had 25GB of space in my SkyDrive account). I dabbled with this starting off by syncing My Documents and My Pictures using LiveMesh .. but the whole experience was a little bit clunky and to be honest .. with a 5GB maximum on there it was never going to be the most useful service to me. I still had tonnes of files sat on my workstation which I needed physical backups for and only having 1 computer I didn’t really get any value out of a “access my files elsewhere” service either which is also what LiveMesh offered.

Then came the game-changer! SkyDrive for Windows launched. This was huge (for me at least) as Microsoft had effectively opened up the floodgates. The new application  had very simple functionality which I tested for all of about 2 hours before removing LiveMesh as quickly as possible .. a worthy replacement had been found!

The new capabilities of SkyDrive allowed me to sync ANYTHING I wanted with my SkyDrive account online, and I could sync up to my maximum file allowance (25GB .. but now options to increase this in increments up as high as 125GB if needed).

I paid for the full 100GB extra storage (which cost me about £30 per year) and this basically takes care of all my backups. It runs seamlessly in the background, and it backs up all my documents, all my music, my pictures, videos and downloads..

The best part is I can access them through the web, so I go to my parents and want to show them some photos or pull up something from one note I can hop on their machine and all my files are “just there” ..

Personal Use – Phone to Desktop file sync (free?)
The final piece to the jigsaw came together about 3 years ago when Windows Phone 7 was launched. I definitely jumped on this with both feet (my previous smartphones being a Nokia N95 and an HTC HD2). This also had SkyDrive integrated right from the get-go .. I could upload photos (automatically as I took them if needed) .. I could read my office files and documents from the built-in office hub straight off SkyDrive .. and it even used SkyDrive for the Twitter and Facebook storage for uploading images if I wanted to share them ..

I’ve kind of marked this as “free” as I was going to buy a phone anyway. It didn’t cost me any extra to get myself a Windows Phone 7 (in many cases cheaper than leading Android and Apple iOS devices) .. so yes, my phone contract cost me money .. but the cloud file sync bit was “free”.

Business Use – Office 365 (£75 per year)
Well, this was mostly a recent requirement as I was formerly full-time worker and let my employer worry about things like hosting email and storing documents .. but in 2010 I joined the increasingly popular contractor route and set myself up with my own company ..

Luckily Microsoft had also recently launched its own Office 365 services .. probably the best bang-for-your-buck online service you can get with fantastic quality, Enterprise level cover and small-business prices.

For £6.25 per month (I went for the E1 plan) I could get:

  • Exchange Online – 25GB email mailbox with the latest Outlook web access
  • SharePoint Online – My own private SharePoint tenant, with all the standard bells and whistles to play with, and ability to invite external “Microsoft Account” users for free to join in!
  • Lync Online – federated with the MSN Messenger / Live Messenger network and all of the other federated Lync users (i.e. Microsoft / other Office 365 users / most Microsoft partner companies).

This to be honest was a no brainer .. I am a SharePoint professional by trade, lets be honest, I was never going to choose anything else (not to mention for the price and featurset Office 365 is simply the best offering out there).

The best bit is I could create “collaborative workspaces” (sorry again!) where I can spin up SharePoint sites (or site collections) to work on stuff with other people.

The typical use case for me is sharing my finance files with my accountant .. and it felt a lot more professional when I can do this on my own branded site and (using my knowledge and experience of SharePoint) offer customised experience specifically for that need.

Business Use – Team Foundation Service (free)
The final piece to the puzzle was Source Control

I do quite a lot of personal projects, typically working on code samples for when I’m speaking at community events (or writing up code for blog articles).

I really struggled to work out how I could get easy backup for my source control… again this stemmed from my experience point .. I have spent almost my entire development career using Team Foundation Server (with a few painful years on Visual SourceSafe) .. the problem is that TFS hosting is typically damned expensive!

Then the miracle came .. Microsoft was offering a preview service called “Team Foundation Service” (https://tfs.visualstudio.com/).

This allowed me to create my own TFS projects and use full source control and even access to build agents!! This eventually went live and Microsoft announced that for small usage (up to 5 TFS projects) it was completely free!

Well .. I made the big leap a while ago, and I am absolutely loving it! I have had to re-install my laptop twice in the past 12 months and I have never had a less painful experience!

The process for getting all of my local files back ended up being:

  • Install Windows
  • Install SkyDrive for Windows
    • Start folder sync
  • Install Office 2013
    • Configure Outlook, start mailbox sync
    • Start SkyDrive Pro sync
  • Leave running overnight

That was it .. next morning all of my files were back. I have never had to run a “backup schedule” or worry about losing my files … stress free and painless computing. It has been so successful, I’ve even gotten my parents running on SkyDrive!

SkyDrive and SkyDrive Pro Explained (Office 2013 and SharePoint 2013)

Ok lets get something straight right off the bat …

SkyDrive Pro is not limited to Office 365. I’ve heard this stated now several times (from both laypersons and SharePoint professionals both) and it is simply not true. If you have a User Profile Service in SharePoint 2013 with My Sites enabled then you get the same SkyDrive Pro features to someone running Office 365 tenants!

Ok, so first off this (https://skydrive.live.com) has absolutely NOTHING to do with “SkyDrive Pro” or SharePoint …
SkyDrive is a free cloud-based storage service that Microsoft have been offering for many many years now. It is part of the Outlook.com family (aka “Hotmail” | “Windows Live” | “Microsoft Account”) and is basically a competing service for the likes of DropBox / iCloud / Google Drive.  By default you get a shared folder allowing you to share files with “the public” but you can also modify the permissions of any folder to either make it available for specific people or for “everyone” if you choose.
It offers a web based interface (as well as apps for Windows 8, Windows Phone, iOS and Android) which allows you to store your documents and files, as well as free lightweight browser versions of Word / Excel / PowerPoint / OneNote.
There is also a desktop application (SkyDrive for Windows, which is the successor to the popular “Live Mesh”) which allows you to synchronise chosen SkyDrive folders to any folder on your computer (Drop-Box style) and this allows two-way synchronisation with that folder to “the cloud” where you files will be backed up and securely stored. The default location for this folder is in your main profile folder (e.g. “C:\Users\martin.hatch\SkyDrive”) but you can select any folder location when the application first runs.
The SkyDrive folder when you have SkyDrive for Windows installed
SkyDrive is also one of the default save locations for Microsoft Office 2013 and also has close integration points with Windows 8 (with baked-in SkyDrive apps) and Windows Phone (auto-upload photos to SkyDrive, and it creates a SkyDrive folder to store twitter / facebook photos when you “share” them).
The default flavour gives you 7GB of storage (the largest amount for any of the leading “free” packages) and allows you to expand this through paid-for storage adding up to 100GB extra content (for a total of 107 GB).
Early adopters of SkyDrive were also rewarded with a “free” storage allowance of 25GB instead of 7GB.
SkyDrive and SkyDrive Pro in SharePoint 2013 (aka “My Site Documents”)
In the eternal fail which is Microsoft marketing naming conventions, there is also a “SkyDrive” link in the “suite links” bar at the top of each page in SharePoint 2013 (this is identical for both Office 365 and On Premise).
SkyDrive appears as a link in the “Suite Bar Links” in SharePoint 2013
This is actually just a link to the “Documents” library in what we used to call your “My Site”. By default this is an empty document library with a folder called “Shared with Everyone”.
To add confusion to this, the top level title and descriptive text when you navigate to this library clearly calls it “Sky Drive Pro” ..
The “SkyDrive Pro” library.. which you get to by clicking the “SkyDrive” link
Why they called the link “SkyDrive” I don’t really know … perhaps “SkyDrive Pro” would have been a better name (keep reading to find out why !)
SkyDrive Pro 2013 – the Windows Application
Now this is where things get really confusing .. if you install Office 2013 Professional Plus then you also get a new application on your computer called “SkyDrive Pro 2013”
The SkyDrive Pro 2013 tile on my Windows 8 Start Screen
This is an application that runs in the desktop system tray and allows you basic access to “sync a library” with your computer. This can be ANY SharePoint 2013 document library (and I have also used it quite successfully with a number of SharePoint 2010 document libraries as well).
SkyDrive Pro is an application that runs in the System Tray
You can do this in one of two ways:
  • Run the “Sync a new Library” from the system tray, and type in the URL of the document library (you can also type in the URL of a site, and it will list the document libraries for you to select)
  • From the SharePoint 2013 interface click the “Sync” button when viewing a library
The “SYNC” link in SharePoint 2013 will launch the SkyDrive Pro 2013 application

Once you sync a library you get a new “SharePoint” folder which appears in your main profile folder alongside My Documents, My Pictures, etc .. (e.g. “C:\Users\martin.hatch\SharePoint”).

If you have synced some libraries using SkyDrive Pro 2013, you get this folder on your PC

For each library that you sync it will create a new subfolder and will basically keep a two-way sync between the two of them (you add, edit or delete a file here and it gets replicated in SharePoint, and vice versa).

Each new folder will get the name “<Site Title> – <Library Title>” although it seems to trim the library title if it is too long.

The contents of my “SharePoint” folder .. having synced a bunch of libraries from SharePoint

The SkyDrive Pro Folder – (also using the Office 2013 Desktop Application)

Just to confuse things even further, there is also another “special” extra that they threw into the mix.

If you sync the “SkyDrive Pro” library in your My Site (i.e. the one you get to if you click the “SkyDrive” link in the page header) then it doesn’t sync to the SharePoint Folder!

Instead it creates a special folder called “SkyDrive Pro” which has the same icon as the main “SkyDrive” icon (if you have SkyDrive for Windows installed as well!). This is also installed in your profile folder (e.g. “C:\Users\martin.hatch\SkyDrive Pro”).
You can of course run both SkyDrive and SkyDrive Pro side-by-side, which is what I have shown below.
SkyDrive Pro folder uses the same icon as the SkyDrive folder ..

This then contains the contents of that actually library, but other than that it works the same way as other synchronised folders.

One thing to note is that if you sync multiple SkyDrive Pro libraryes (say from different My Sites or different Office 365 tenants) then it will create multiple SkyDrive Pro folders.

Syncing more than one SkyDrive Pro folder creates awesome folder names ..

I have read elsewhere that you can rename these folders but when I tried to do this I started getting sync errors!

Trying to “Sync” a SharePoint 2013 folder without “SkyDrive Pro 2013” installed
This is another one which I have heard said before which is that trying to “Sync” a SharePoint 2013 library when you don’t have Office 2013 installed (more specifically the SkyDrive Pro 2013 bit) will automatically install it on the fly… ?? … erm … no it doesn’t.
I tried this on my development VM (which doesn’t have office installed) and I got two weird prompts in a row ..
First I got a weird IE10 “do you want to allow this website to open an app on your computer?” question .. which immediately got alarm bells ringing ..
This could be installing an app on the fly .. couldn’t it?
But then you get a generic “No apps are installed to open this type of link (grvopen)” error .. So basically it was trying to open a file which I don’t have apps supported for.
So it would seem that, no, you can’t sync libraries without SkyDrive Pro 2013 installed.
Fail and Error .. although interesting “Groove” reference
My final parting shot on this is the interesting app type (grvopen) which is clearly a reference to “Groove Open” .. for those who don’t know way back the old SharePoint synchronisation tool was an application called “Groove”. This eventually got replaced with “SharePoint Workspace” which has now been replaced in the latest build with “SkyDrive Pro 2013”.
I honestly don’t know if you can “Sync” with SharePoint Workspace or not, would love to hear if you can!
So, that outlines the rough difference between Sky Drive and SkyDrive Pro J
  • SkyDrive is a free service from Microsoft, and has nothing to do with Office or SharePoint
  • SkyDrive for Windows is a free desktop application which you can use to sync your SkyDrive folders with your computer
  • SkyDrive Pro is the personal library in your My Site, and you get to it from a “SkyDrive” link in the SharePoint 2013 header
  • SkyDrive Pro 2013 is an Office 2013 desktop application which you can use to sync SharePoint libraries to your computer (including your personal “SkyDrive Pro” library)

How to place custom HTML in the Office 365 public website footer

This is the second time I’ve come to do this, so thought I’d ping out a quick blog post showing how it works.

The requirement is simple, how to get a “proper” Copyright symbol in the footer of a public website? (although you can also use this technique for other methods too .. such as adding analytics tracking codes and JavaScript to your site!)

The Problem – OOTB dialog does now allow HTML editing
When you are using the standard Office 365 public website editor, you are stuck with the standard dialogs for header / footer / theme and such.

The “footer” dialog is woefully lacking, and doesn’t even allow basic HTML editing

This unfortunately leaves you with an extremely basic footer text, missing items which you would normally include (such as the Copyright symbol ©).

SharePoint Designer to the rescue ..

Yes .. I admit I didn’t really expect to hear myself saying this either, but it does seem like SharePoint designer is the answer here.

The actually footer text values are stored in the SPWeb.Properties bag, in a specific property called wh_footertext.

(in fact .. if you look through the properties there are all sorts of values to play about with, including the logo URL, Footer links, site usage information, and a few HTML placeholders for things like Left Nav and the Site Map .. well worth a look!).

So, when you open up SharePoint Designer you can actually get to the Properties values by using the Site Options link in the Ribbon;

This opens up a simple dialog picker where you can modify any of the available properties;

And when you edit the wh_footertext then you get complete control over the entire footer (including, interestingly enough, the wrapping SPAN tags as well!)

Having made this simple change we simply refresh our webpage and all is done 🙂

Another simple but quick one. Hope you find it useful!

DNS Records required to use Lync Online (Office 365) with a Vanity Domain

Note – this only applies if you have your own “vanity domain” such as companyname.com. This does not apply if you are using the Microsoft Online domains “onmicrosoft.com”

I’ve seen quite a few people asking for help with this, and struggled a little bit when I first set this up myself, so I thought I would post the DNS entries that are required to get Lync Online working.

These are generic DNS records, so it doesn’t matter what server / service you have.

Now, first off you will need to get yourself a relatively advanced DNS Management Service. I personally use the most excellent Zone Edit (www.zoneedit.com). This is completely free and allows you a very high level of control over what records you can create. I have found with some of the other DNS management sites that sometimes you cannot create some of the required records (such as SRV records).
DNS Records described by Office 365 Portal

There is 1 SRV record and 2 CNAME records that you need to create.

You can find these in your Office 365 Portal under “Domains” and “verify DNS Settings”. Below is the screenshot from my own Portal Site for my domain “hatchsolutions.co.uk”.

The thing to note is that it gives you the full host-name entry for each of the records you need to create. When you actually create these (depending on your DNS management tool) you will probably only need the prefix for the host name.

So the three records you need to create are:

  • _sipfederationtls
    • Type: SRV
    • Port: 5061
    • Weight: 1
    • Priority: 100
    • TTL: 3600 (seconds)
    • Target: sipfed.online.lync.com
  • sip
    • Type: CNAME
    • TTL: 3600 (seconds)
    • Host-Name: sipdir.online.lync.com
  • lyncdiscover
    • Type: CNAME
    • TTL: 3600 (seconds)
    • Host-Name: webdir.online.lync.com

So you can see above, I have only used the initial part of the full hostname. Having a CNAME record called “sip” in my managed domain “hatchsolutions.co.uk” gives me the fully-qualified address “sip.hatchsolutions.co.uk”.

But … that’s not all …

I also found in my environment that one more SRV record was required, which for some reason was missing from the official instructions. I honestly can’t remember where I found this (credit goes to someone wonderful person on the blogosphere somewhere) but the details are below:

  • _sip._tls
    • Type: SRV
    • Port: 443
    • Weight: 1
    • Priority: 100
    • TTL: 3600 (seconds)
    • Target: sipdir.online.lync.com

I found that once that is also in place, everything started working. You may need to wait for 24 hours (for this to propogate round the world’s DNS servers) and you should be good to go! (I think I had to wait a good few hours before mine started working .. so please be patient!)

Update – Publishing Features “not supported” on Office 365 Public Websites

This has been a bit of an on-running saga for many of you in the community and I have to admit I’ve found it as confusing (and sometimes frustrating) as the next person.

I have had an Office 365 Community forum thread running for a while now which originally stated that this was allowed:

“If there’s a feature in your site that’s able to be activated, you’re still within the terms of your agreement if you activate it”

This was initially great news, although the euphoria was short lived as I finally got in touch with Mark Kashman (Senior Product Manager on the SharePoint Team at Microsoft, specialising in Office 365 and SharePoint Online).

We had a bit of an email dialog  and the crux of it has been updated in the community thread linked at the beginning of this post. The details have been included below:

“The SharePoint Online public-facing website does not grant use rights to leverage the publishing portal components in Office 365. These features are only supported for intranet sites within the private site collections you create from the SharePoint Online Administration Center. For now, the public-facing site is configurable by use of the Site Designer ribbon tool. Microsoft only supports what Site Designer enables.”

As disappointing as this is I have to admit I’m not entirely surprised, and hopefully this will be addressed at some point in the future. In fact Mark goes on to say:

“The feedback from this thread, and companion posts in and outside of the Office 365 Community site, are important in helping guide planning for how Microsoft may offer web content management (WCM) driven public websites that can leverage the SharePoint’s powerful publishing infrastructure components and are licensed appropriately. I, too, will take the action item to add additional clarity on this same point within the next update to the SharePoint Online service description here: go.microsoft.com/fwlink

Now, I have asked the question .. does this mean we are not allowed  to activate these features, or Microsoft simply won’t support our environments if we do this?

I am hoping for a response soon, and will update you when I know more! Watch this space…

How to enable Anonymous Access to a blog site on your Office 365 public website

This has been plaguing the forums for weeks now .. if I had a pound for everytime I’ve seen someone complaining about blogs on Office 365 .. I’d have .. erm .. about £15 ..

But seriously, this is something that a lot of folks have been complaining about .. but no more! 🙂

One thing that definately surprised me is that you can set anonymous permissions through Sandbox Solutions! This means that we can write our own custom code to enable full anonymous access for comments, categories and posts 🙂 So I’ve done just that.

A link to download a Sandbox Solution can be found below. Just upload the WSP to your public website site collection, activate it, and drop the new “Hatch Solutions” web part onto the home page of your blog 🙂

NOTE: For those who aren’t interested in how this works, and just want the web part, you can grab the WSP package here.

This installs a Web Part. Place this webpart on the home page of your Blog site, and hit the big button… it should do all of the work for you.

Important: You don’t need to keep the webpart on there. Once you’ve checked it is working you can remove the webpart and remove the WSP from your Solution Gallery!

Regional Settings –  There have been numerous reported issues regarding regional settings (as the code looks for lists called “Posts” and “Comments”). Currently this WSP only works when your SharePoint Site regional settings are set to English.

So what are we doing?
This is really quite simple. The SharePoint API exposes the list permissions for anonymous users through an SPList property called AnonymousPermMask64. This is an enumeration of SPBasePermissions values which effectively describe what access anonymous users have.

The reason this doesn’t work by default for anonymous users is because the “ViewFormPages” permissions is not included by default!

So our code is quite simple:

// get the “Comments” list
SPList list = SPContext.Current.Web.Lists[“Comments”];

// check if it has unique permissions

// make sure people can edit their own items
list.WriteSecurity = 2;

// grant permissions to anonymous users
list.AnonymousPermMask64 =
  (SPBasePermissions.Open |
   SPBasePermissions.OpenItems |
   SPBasePermissions.ViewFormPages |
   SPBasePermissions.ViewListItems |


So all we are doing there is granting some additional permissions (ViewFormPages, ViewListItems and AddListItems) for anonymous users. Then we just rinse-and-repeat for Posts and Categories (but remember to remove the “AddListItems” bit!! otherwise anonymous users would be able to create new blog posts!).

That’s it! I have a (short-lived) demo running on my current Office 365 site: www.hatchsolutions.co.uk/Blog/

Note – depending on how much spam and rubbish ends up on there, I will probably delete it sooner rather than later. I’ll try and remember to update this post after I have.
To make this easy for you I have built a Web Part which you can download and install (link at the top of this post) which does all of the work for you.

So that is all you should need .. happy blogging folks!! (all we need now is a decent blog template with things like CAPTCHA.. )

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;

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 🙂

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 !!