Aptillon Blog

Using PowerShell to create new sites based on site-scoped WebTemplates

Posted by Maurice Prather

WebTemplates are definitely a powerful new construct in our SharePoint 2010 toolbox.  WebTemplates definitely come in handy as they can be deployed as sandbox-compatible features.

Creating a site based on a web template is pretty straightforward via the UI. Basically it just shows up as another site template option. As a user creating a site, you’d never the know the difference between a farm-scoped or site-scoped WebTemplate. However, if you want to use PowerShell, you will notice that your PS scripts will take on a slightly different shape based on how the WebTemplate is scoped.

If the WebTemplate is deployed as a farm-scoped feature, then you can easily use New-SPWeb in the following manner:

new-spweb $url –template “{GUID}#WebTemplateName”


where GUID represents the parent feature ID.

If the WebTemplate is deployed as a site-scoped feature, then your PowerShell needs to be adjusted.  Otherwise, if you attempt to use new-spweb, you’ll get the following error message: Template is not found and is not applied.  This effectively means the cmdlet could not locate a farm-level template to apply to the new site.

For example...



There are two ways to circumvent this problem:

  1. Once the site is created, call ApplyWebTemplate
  2. Before the site created, grab a reference to the appropriate WebTemplate and provide it as a value to the SPWebCollection.Add method on the parent site.


Calling ApplyWebTemplate

$url = "http://sitecollection/site1"

$w = new-spweb $url



Calling SPWebCollection.Add

$url = "http://sitecollection"

$w = get-spweb $url

$template = $w.GetAvailableWebTemplates(1033) | ? { $_.name -eq "{GUID}#WebTemplateName" }

$w.Webs.Add("site1", "sample site 1", "sample description", 1033, $template, $false, $false)


The difference between the two methods basically boils down to the language selection for the new site. With the simple call to ApplyWebTemplate, the new site uses the same language as the parent. By grabbing the reference to the web template beforehand, you have more control.



SharePoint Conference 2011 Wrap Up

Posted by Maurice Prather

This year’s SharePoint Conference was probably one of the most interesting conferences that Microsoft has hosted in the past few years.  The attendance was solid and presentations covered the spectrum from 101 fundamentals over all the way over to nitty-gritty details.

Monday morning I had a chance to present on managing the Sandboxed Code Service (SP376).  I was a little skeptical that we’d fill a room with 700 seats, but I was very pleasantly surprised to see the room fill up before we switched on the microphone.  There were a ton of good questions afterwards as well.  Thanks to everyone who attended and posted all the great messages on Twitter. If you have any questions I was unable to answer, please feel free to reach out.

The conference was also a great chance to run into folks.  I saw many old friends – some that I haven’t seen literally in years – as well as many clients and former Critical Path Training admin and dev students.  It’s always amazing to see the positive energy!

The Aptillon team also had record number of presentations at the conference.  We had 7 presentations by 6 different teammates.  As a company partner, that is definitely very cool stat however the nicer fact is that we had a chance to hang out.  Since we’re spread out all over the US and constantly on the go, it’s rare to have more than 2 people in the same room at the same time. 

There was also a record number of Microsoft Certified Masters from across the globe at the conference.  How cool is that?  I remember the days when Spence and I were the only MCMs who weren’t employed by Microsoft. :) MSL also announced a new certification – Microsoft Certified Architect.  It’s really nice to see program growing!

Great conversations all around. New projects, new ideas, confirmation of design decisions... chatting about the sandbox, helping folks get a better perspectives on PowerPivot and it’s amazing potential, the cloud, getting out of the sandbox (aka azure), Windows Phone 7, watching cloud-servicing applications such as Sharevolution hit their stride, building new partnerships... truly exciting stuff!



Announcing the Global Shape Remover for Excel Workbooks!

Posted by Maurice Prather

Are you tired of seeing the “Unsupported Features” warning whenever you view an Excel workbook on your SharePoint site?

Do you work with PowerPivot? If so, you are probably going to see this notification bar all the time. 

Excel Services will display a notification bar if it has detected that your workbook contains an object that it cannot render.  It take up space and really doesn’t give the user any tangible instructions on what is causing the problem.  Thus the workbook authors are left to randomly “clean up” their workbooks.

PowerPivot users will really like this feature… why?  PowerPivot automatically adds rectangles (i.e. shapes) around the slicers that control your pivot tables.  Depending on how you close the file, PowerPivot may not remove the rectangles.

What’s the generic fix? Remove the shapes manually before uploading to SharePoint.

Is that a smart way to do it?  Nope.  Simply put it’s too hard to go through all the worksheets in a workbook to remove the shapes before saving the file to a SharePoint site. Are you willing to do this every time you save your file, for every file?  We’re not!

The Global Shape Remover was designed to specifically handle the task of removing shapes from your workbooks!

Shape Remover ReportTurn on the feature and you’re done!  Any time you upload or edit a workbook, the Global Shape Remover will clean up your workbook for you. It works silently in the background! If the Global Shape Remover removes anything it generates a report that outlines what it removed and where from – you’ll have a worksheet that you can use to help find shapes if you decide that need to make a manual adjustment.

What’s even nicer about the Global Shape Remover? It’s sandbox-compatible!  That’s right – we’re talking about a handy tool that can be deployed without the need to involve a farm administrator!

If you a site collection administrator, all you need to do is upload the file to your Solution gallery and away you go.  How easy is that?

Give it a try!  Download a free trial version today and see how easy it is to get rid of that annoying warning dialog.