Archive

Archive for May, 2014

How to Brand SharePoint 2013 My Sites: Part 3: Applying Site Master Pages

Hi There

So far this series consists of the following posts:

We now have a solution that shows links to all of the layouts pages we need to manipulate design packages via the Site Settings page except for Master Pages.

This post shows you how to create a page similar to the OOTB SharePoint Site Master Page Settings that will work in a SharePoint My Site.

Adding the link is simple enough, it is defined in the Publishing feature which is not activated in My Sites, see part 2 for an explanation of probably why not.  The Id of the feature is “AreaChromeSettings”.

Easy enough to add the link back we just copy the definition, change its name and add it to our site scoped feature.  We deploy and activate the feature and the link is displayed.

However if you do this you’ll just get a blank page.

Digging into this its due to the code behind on the page that is trying to work out which master pages are appropriate and using various parts of publishing to do so.  If you check in the ULS logs you’ll see it raises a the following error:

One or more field types are not installed properly. Go to the list settings page to delete these fields.<nativehr>0x81020014</nativehr><nativestack></nativestack>, StackTrace:

at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()

Chasing it through via .NET Reflector (or ILSpy) shows that the code behind uses numerous items from the publishing namespace.

Using this page is not an option.  Neither is the “Change the Look” page as it won’t show anything other than those pages with a preview page.  We could create a mysite.preview page and upload it which would allow us to select the master page this way but doing so means that we are really beginning to change the default site.

The best approach is to write your own Set Master Page application page and provide a link in the Site Settings under look and feel based on the existing link in the Publishing feature.

Once done you can set the master page this way and then create your design package as normal.

Next we will move onto how to automatically band a site when it is created.

Cheers

Sebastian

 

How to Brand SharePoint 2013 My Sites: Part 2: Adding Design Packages Links via a Feature

Hi There

So far this series consists of the following posts:

Continuing on the ‘how to brand my sites’ with minimal programming series.  We saw how by typing URLs directly into the browser we could access all of the pages we needed in a my site to create, save and apply a design package, except for setting the master page which we used SharePoint designer to handle.  This wasn’t too surprising as these pages are in the _layouts folder which is available to every site.  However it was a bit painful compared to using the Site Settings page to access them.  In this post we’ll look at how we can create a purely declarative (no code) feature that puts these links back for us.

To do this we need to examine the features that normally place these links on a site; the features that remove them from My Sites and as a result we’ll understand why they aren’t available by default and also why we can safely add them back so long as we are using Standard edition.

There are two features that put the required links on the Site Settings page:

  • SiteSettings, this shows the themes links.
  • HtmlDesign, this shows the design settings links.

HtmlDesign is a hidden feature which is part of Publishing which is NOT part of SharePoint Foundation.  My Sites are part of SharePoint Foundation however so these do not get activated by default.  You can activate them but they have other dependencies on Publishing features and so unless you make every My Site a publishing site this will fail.  This behaviour appears to be by design.

I haven’t tried it but gut feel is that making your my sites publishing sites may not be a good idea as it provides users with a more complex interface and also there can easily be a lot of my sites.  A five hundred user system might have a hundred publishing content sites and publishing sites use more disk and resource than standard my sites so this would be a significant size increase.  Having said this it might be the way you decide to go but even if you do you’ll still be missing the themes links.

SiteSettings is Farm scoped so it is activated in all sites by default and this places the two themes links onto every page.  However the MySiteUnifiedNavigation feature then hides these, presumably as without the HtmlDesign links they have little use.

So how do we get these links to show?

Simple we create a new Site scoped feature, copy the relevant CustomAction tags from the features and change the name of them so they will not clash.  Then we activate it where we need it and we will have the links, except for the set master page one.  We can then use the process in part one of this guide but now navigating via Site Settings to create a design package on our development farm.  We can then copy this package to our production farm and either deploy and activate our feature so we can import the design package or, as we tend to do, just use PowerShell to import the design package so that in production things are much more like OOTB SharePoint.

However we have not finished yet there are still a few more tasks to do.

  • Give access to the set master page functionality without requiring SharePoint designer.
  • Handle the ‘multiple site collection / site’ nature of my sites.
  • Brand the sites automatically on creation.

More on this tomorrow.

Cheers

Sebastian

 

How to Brand SharePoint 2013 My Sites: Part 1: Using Design Packages

 

Hi Folks

So far this series consists of the following posts:

I’ve been asked to brand a SharePoint 2013 On-Premise Farm for a client, a London Law Firm.

Easy enough but there are certain restrictions. The last company that did this produced a very code heavy solution that is now getting difficult to maintain as the company has been bought twice and the internal staff on the project have all left.

Once bitten twice shy so custom code is to be kept to an absolute minimum.

The branding of the Content Sites is easy enough I worked with a designer and we mocked it up using a development farm, saved it to a design package and then used PowerShell to import it to the pilot site.

Then the next sites up where the My Sites. They don’t have the site settings page links to let you get at anything other than the Composed Looks link.

However all of those pages live in the LAYOUTS folder which is available on all sites so we typed the URLs in and off we went.

The mechanism is as you would expect.

  1. Go to Web Designer Galleries > Themes (use http://mysites.sharepoint.local/_catalogs/theme/Forms/AllItems.aspx) and upload spcolor and spfont files.
  2. Go to Web Designer Galleries > Master pages and page layouts (use http://mysites.sharepoint.local/_catalogs/masterpage/Forms/AllItems.aspx) and upload master files.
  3. Go to Web Designer Galleries > Composed Looks (use http://mysites.sharepoint.local/_catalogs/design/AllItems.aspx) and create a new composed look.
  4. Go to Look and Feel > Change the look (use http://mysites.sharepoint.local/_layouts/15/designgallery.aspx) and select your look.
  5. Go to Look and Feel > Design Manager (use http://mysites.sharepoint.local/_layouts/15/DesignWelcomePage.aspx) and export your design package.
  6. OR Go to Create Design Package (use http://mysites.sharepoint.local/_layouts/15/DesignPackageExport.aspx) and export your design package.
  7. Go to Look and Feel > Import Design Package (use http://mysites.sharepoint.local/_layouts/15/DesignPackageInstall.aspx) and export your design package.

As you can copy the design package between farms you can use step 7 to move your design around.

Things to note:

  1. You can create a link to the Look and Feel > Master page (use http://mysites.sharepoint.local/_layouts/15/ChangeSiteMasterPage.aspx) but it will just display a blank page.  However SharePoint Designer works just fine.
  2. MySites have three components each of which have to have the design package imported.
    1. My Sites Host Collection, the root site typically one per farm, uses the mysite15.master.
    2. My Site, one per user, uses the mysite15.master.
    3. My Blog, one per user, uses the seattle.master.
  3. MySites component sites all have different WebTemplate.
    1. My Sites Host Collection, SPSPORTAL#0.
    2. My Site, SPSPERS#2.
    3. My Blog, one per user, BLOG#0.

Tests show that this works perfectly, exactly as you would expect however cutting and pasting all those URLs is not fun.

The next post in this series will explain how a small declarative feature can make this much easier.

Cheers

Sebastian