Deploy a SharePoint Master Page as a Feature

SharePoint master pages are sort of designed to be created in SharePoint Designer. This isn’t much good, though, if you want to redeploy a master page to another or multiple systems. Also, a master page that has been created in SharePoint designer is “Customized” – that is, it is stored in the database rather than as a file on the file system. This makes it a bit slower.

What I wanted to be able to do for a customer was to create a SharePoint feature that would deploy all my physical files, and in such a way that they weren’t customised. Well, I think I’ve done that.

I pretty much followed the gist of this blog entry by Chris O’Brien (his blog is excellent and well worth a read).

You can also get a feel for it by examining the PublishingLayouts feature that comes standard in MOSS. That feature deploys all of the OOB master pages, etc..

In short, the approach is:

  • Create design in SharePoint Designer
  • Copy and paste master page code to a new aspx file in your feature, with the same name as the file in SharePoint Designer. (Do not just save the file in SharePoint Designer to the file system. It mucks up the links. Copy and Paste the code – just as Chris says to. Guess who forgot?)
  • Save all other relevant files to the your feature.
  • Create the Feature.xml file
  • Create the Elements manifest file. Note that the XML is case sensitive, and the case used in the blog entry above is wrong.
  • Make sure that the permissions on the feature folder are correct and inherited by child files and folders.
  • Run “stsadm -o installfeature -name featurename”
  • Activate feature at site or sitecollection level.

Attached is an example feature that installs a (rubbish) master page I’ve created called ‘Cairngorm’. To install it:

  • Unzip the archive
  • Copy the CairngormMaster folder to your Features folder in 12 Hive
  • Check its permissions
  • Run
    stsadm -o installfeature -name CairngormMaster
  • Go to the Site Collection Features page, and activate it.

You should now find that you can select the ‘Cairngorm’ master page from the ‘Site Settings > Master Pages’ page. Select it for your master pages, and you should find your pages go a bit black and orange! You can get the dodgy design I came up with here, but please just use as an example – it looks bleedin’ awful.

Deploy a SharePoint Master Page as a Feature

SharePoint Branding or "Pimp my SharePoint"

One of the things that customers appear to want, and will like about SharePoint is the ability to ‘brand’ or ‘skin’ it. For some reason, it’s something that people always get hung up on – what it looks like, not how it works – and I don’t expect we will have many projects that don’t have the question of branding/skinning/customisation. But what does this mean, how does it work, and what are the limitations? Continue reading “SharePoint Branding or "Pimp my SharePoint"” →

SharePoint Branding or "Pimp my SharePoint"

Abject Failure and Complexity

I’ve been meaning to post this for ages – Marus Ranum on why information security is an abject failure. And he’s right – the problem is the complexity of todays interactions, both at a protocol and language level.

To me, the problem is one of failure of KISS (Keep It Simple, Stupid). Applications and protocols haven’t been, and we’ve had more tacking together of technologies, and expansion of complexity of everything.

I mean, consider what languages you needed to know 10 years ago, and now:

Then:

HTML 3.2, JavaScript maybe, Perl if you’re brave, SQL if you’re a hero.

Now (Microsoft Stack only):

HTML 3.4, 4 (various favours), XHTML, XML, XSL, XPATH, JavaScript (much more complex), ASP.NET 2.0, C# or VB, .NET frameworks 1.1, 2, 3 and 3.5 (soon), ADO, SQL, CSS, ‘AJAX’

That’s just the languages and base technologies – never mind getting into a higher level of software (e.g. SharePoint). Or non-MS technologies – Ruby, Rails, Python, Java in various forms…

It’s similar in protocols…

Then:

HTTP, HTTPS, FTP, SMTP / POP

Now:

HTTP, HTTPS, FTP, SMTP / POP, SOAP, Web Services (plus various extensions), IMAP, Various Peer-To-Peer protocols, Various Instant Messaging protocols

(Yes, those are fairly high level, and from different levels of the stack – but still, you’re expected to know about them.) (And yes, I suppose you’d need to know a bit about TCP/IP and IPSEC)

Does that sound simple? Does my granny skateboard?

(Well, no, but that would be so cool).

Security will be impossible with such a complex, varied stack of technologies, and developers simply won’t be able to specialise enough to know how to make secure enough applications. It alarms me how wrong people are getting password storage alone – I mean, this stuff has been known since the 70’s. If they can’t get that right, how will they manage with a such a deep and varied set of tools?

Abject Failure and Complexity

Georeplication in SharePoint

More for my benefit than anyone else, but there is blog post on Joris Poelman’s (JOPX) blog about georeplication in SharePoint. The crux of it is, SharePoint 2007 doesn’t really do it. But you could implement your own using the Content Migration APIs – which Stefan Gossner goes into in parts 1,2,3,4.

However, if you are considering a system using georeplication, please remember you must have enough bandwidth. If your network can’t handle the traffic needed over it already, before adding georeplication, then you are buggered. Georeplication might reduce cross site traffic, but you still need the bandwidth to actually do the replication. And you’ll have to be able to live with slow replication. And, as mentioned above (and by Joris), it is a significant development exercise.

I’m sure someone will do it though. And I’m confident that Microsoft will do it for a future version of SharePoint. It’s too powerful a feature to not have in an enterprise app.

Georeplication in SharePoint

Using a different Master Page on Application Pages

Previously I found (in ‘David’s Blog’) a way of using an HTTP Module in SharePoint to change the master page used by ‘application’ pages. I fiddled with it a bit and made it work properly.

Unfortunately, I’ve lost my code (HD crash) and David’s blog is defunct (I think it died when the SharePoint Blogs site died).

So, some links to similar relevant pages:

Liam Cleary has been looking at it

This page proved useful

And this is a description of the same sort of thing

Using a different Master Page on Application Pages