Microsoft Extends SharePoint Virtualization Support to Hyper-V

Microsoft announced today that it will be offering Support for MOSS SP1 and WSS SP1 running under any Virtualization Software that meets the requirements of the Microsoft Server Virtualization Validation Program (SVVP).  As of now Microsoft will support SharePoint running on Hyper-V in a Server 2008 environment and running on Virtual Server 2005.

This is also an important announcement for those who want to run SharePoint on Vmware.  Although they aren’t currently listed on the SVVP website, NetworkWorld is reporting that Microsoft and VMware have reached agreement this week for VMware to join the SVVP.  There is no Press release on this, but you can read the Network World article here:

http://www.networkworld.com/news/2008/081908-vmware.html

You can find out more information about Microsoft’s expanded Virtualization Support for SharePoint from the SharePoint Team BLOG at:

http://blogs.msdn.com/sharepoint/archive/2008/08/18/update-on-virtualization-support-for-sharepoint-products-and-technologies.aspx

Adding Custom Web Part Page Templates

I was recently asked whether it was possible to add custom Web Part Page templates to the Create page in SharePoint 2007 or whether the interface was limited to the eight existing Web Part Pages and required you to replace one of those.  I knew this was possible in SharePoint 2003 and that there was an MSDN article entitled Creating Custom Web Part Page Templates for Microsoft SharePoint Products and Technologies that explained how to do it.  But since I had never tried it in 2007 I decided to investigate.

It turns out that the answer isn’t a simple yes or no.  The link on the Create page uses a page called  spcf.aspx to list out the web part templates.  Although you can easily add a ninth template to the list the page uses owssvr.dll to instantiate the new web part page and it seems to be hard coded to only accept templates numbered 1 through 8.  So you can’t simply create a custom copy of spcf.aspx with a modified list of Web Part Page templates.  But there is still a way to implement a set of Custom Web Part Page templates.

Interestingly enough if you follow the directions in the SharePoint 2003 MSDN article mentioned above and use the files downloaded from the article you can make this work.  The spcf.aspx file in the article download does not use owssvr.dll and is not limited to only 8 templates.  The problem is that this file was designed for SharePoint 2003 and continues the look and feel of that product.  You also have to make allowances for some path changes since the 2003 product.  So I decided to update the custom page to use a SharePoint 2007 Master Page and relist the steps in the article with modifications for the SharePoint 2007 environment.

NOTE: In addition to updating the custom creation page for a Master Page environment certain code changes were also required.  You must use the custspcf.aspx code available for download from this BLOG as a starting point to make this work.

Steps to add Custom Web Part Page Templates

  • Download custom creation page (custspcf.aspx) from here and copy it 12 hive on your Web front end servers.  The file should be copied to the following directory Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS\1033.   (Note: If you are running on a server installed in a language other than English replace 1033 with the Language Code Identifier for your language.)
  • Open the new custspcf.aspx file in Visual Studio or another suitable text/html editor.
  • Search for onetidWebPartPageTemplate in the custspcf.aspx file.  This is the ID of the selection list for the Web Part Page templates.  There are two selections already included for the file, one for Custom1.aspx (set to be the default selection) and the other for Custom2.aspx.  If you only want two custom templates skip step 4.
  • To add additional templates increment the size attribute of the Select element to the number of choices in the list and duplicate the second Option element in the list.  Change the name value of the Option element using a pattern of Custom#, where # is the next index in the list of selections.
  • Add the new custom Web Part Page template, named Custom# to match the entry in step 4, to the Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS directory.  
  • Copy an image file named Custom#.gif for each of the Web Part Page templates you wish to add where # is the number of the template in the list to Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS\1033\IMAGES
  • Add a Link to custspcf.aspx to the Create.aspx page stored in the Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS directory.  NOTE: You may need to put a copy of this page back in the future so make sure you have a backup copy before editing it.    To add the link search for onetidWebPartPage.  Go to the next tag and insert the following code block immediately after the tag, but before the start of the "/>".
      1: <table style="padding: 3px 0px 3px 4px;" class="ms-itemstatic" onclick="javascript:NavigateInnerHref(event)" onmouseover="this.className='ms-itemhover';ShowListInformation('"
    
      2:   <SharePoint:EncodedLiteral runat="server" EncodeMethod="EcmaScriptStringLiteralEncode" Text=""
    
      3:   <%$Resources:wss,viewlsts_wp_page_title%>
    
      4:     "/>','<SharePoint:EncodedLiteral runat="server" EncodeMethod="EcmaScriptStringLiteralEncode" Text=""<%$Resources:wss,viewlsts_wp_page_desc%>
    
      5:       "/>','/_layouts/images/ltsmrtpg.gif')" onmouseout="this.className='ms-itemstatic';HideListInformation()" cellspacing="0" cellpadding="0" width="100%" border="0">
    
      6:       <tr>
    
      7:         <td valign="top" nowrap="" class="ms-descriptiontext" style="padding-top:1px">
    
      8:           <IMG src="/_layouts/images/setrect.gif" width="5px" height="5px" alt=""
    
      9:           <SharePoint:EncodedLiteral runat='server' text=''
    
     10:           <%$Resources:wss,viewlsts_wp_page_desc%>' EncodeMethod='HtmlEncode'/>">&nbsp;
    
     11:         </td>
    
     12:         <td valign="top" width="100"% class="ms-descriptiontext">
    
     13:           <a id="onetidCustWebPartPage" href="Custspcf.aspx" target="_self">
    
     14:             <SharePoint:EncodedLiteral runat="server" text="Custom Web Part Page" EncodeMethod='HtmlEncode'/>
    
     15:           </a>
    
     16:         </td>
    
     17:       </tr>
    
     18:     </table>

That’s all you need.  The next time you browse to the Create page you will see a link to Custom Web Part Page.  When you click that link you will see a page that looks like the regular creation page for Web Part Pages, but this one will have your custom templates on it. Even better you will be able to add more than 8 to the list and it will continue to work.  Just like it did in SharePoint 2003.