Sharad Kumar

MVP (SharePoint Server), MCTS (SharePoint Services), MCP (ASP.NET).

  • SharePoint 2010 – Central Admin tooling to create host header site collections

    Just like SharePoint 2007, you can create host-header based site collections in SharePoint 2010 as well. It means, that you do not necessarily need to create a site-collection under a managed path like /sites/, you can create multiple root-level site collections on same web-application/port by using host-header site collections. All you need to do is point your domain or sub-domain to your web-application and create a matching site-collection that you want.

    But, just like in 2007, it is something that you do by using STSADM, and is not available on Central Admin UI in 2010 as well. Yeah, though you can now also use PowerShell to create one:

    C:\PS>$w = Get-SPWebApplication http://sitename
     
    C:\PS>New-SPSite http://www.contoso.com -OwnerAlias "DOMAIN\jdoe" -HostHeaderWebApplication $w -Title "Contoso" -Template "STS#0"
     
    This example creates a host header site collection. Because the template is provided, the root Web of this site collection will be created.

    I’ve been playing with WCM in SharePoint 2010 more and more, and for that I preferred creating hosts file entries for desired domains and create site-collections by those headers – in my dev environment. I used PowerShell initially, but then got interested to build my own UI on Central Admin instead.

    Developed with Visual Studio 2010

    So I used new Visual Studio 2010 tooling to create an empty SharePoint 2010 project. Added an application page (there is no option to add _Admin page item in VS 2010 RC), that got created in Layouts “mapped” folder. Created a new Admin mapped folder for 14-“hive”, and moved my new page there instead. Yes, I didn’t change the base class for page, its just that it runs under _admin, but it is indeed a LayoutsPageBase inherited page.

    image

    To introduce a action-link in Central Admin console, I created following element:

       1:  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
       2:    <CustomAction
       3:          Id="CreateSiteByHeader"
       4:          Location="Microsoft.SharePoint.Administration.Applications"
       5:          Title="Create site collections by host header"
       6:          GroupId="SiteCollections"
       7:          Sequence="15"
       8:          RequiredAdmin="Delegated"
       9:          Description="Create a new top-level web site, by host header" >
      10:      <UrlAction Url="/_admin/OfficeToolbox/CreateSiteByHeader.aspx"  />
      11:    </CustomAction>
      12:  </Elements>

    Used Reflector to understand any special code behind createpage.aspx, and created a new for our purpose – CreateSiteByHeader.aspx. From there I quickly created a similar code behind, without all the fancy of Farm Config Wizard handling and dealt with alternate implementations of sealed classes! Goal was to create a professional looking and OOB-type experience. I also added Regex validation to ensure user types a valid domain name as header value. Below is the result…

    image 

    Release @ Codeplex

    I’ve released to WSP on OfficeToolbox @ Codeplex, and you can download from here.

    Update - Latest release is now uploaded and works with RTM.

    Hope you find it useful…

    -- Sharad

  • Aggregate SharePoint Event/Items into your Calendar view using Calendar Overlay

    One of the most common features I have seen in common use for SharePoint (prior to 2010) in Intranet environments for Team site is Calendar’s. Not only the Calendar list type, but also the ability to add a Calendar view to any list that has the desired columns to construct a Calendar – such as Start, End, Title etc. While this was all great for a single site/calendar, the problem of having to track numerous calendar’s remained. With introduction of Outlook 2007 bi-directional integration with SharePoint, and particularly the ability of Outlook to overlay calendar helped bridge the gap. Now one could connect to number of team sites, and setup Calendar overlays in Outlook using varying colours, to easily identify event source and yet benefit from the plotting of events on single Calendar view. This was all good, but each user in your Enterprise was supposed to setup in a “pull” fashion. This is good for flexibility, not so good when you need to “push” consistency and productivity (re-use).

  • SharePoint 2010 – Setting Up Development Machine on Windows 7

    You probably already know that SharePoint 2010 supports installing on 64-bit Windows 7 and Vista, for developers. I’ll give you a quick walkthrough of how I’m setting up my development machine, in continuation of my new found love for native-boot with VHDs.

    My objectives

    I want flexible approach so that I can work with future builds of SP 2010, and not needing to build whole environment each time.

    1. Use Windows 7 x64 developer desktop for SharePoint 2010 and Visual Studio 2010 Beta.
    2. Be able to quickly start afresh from base machine/image, on demand. (thinking VHDs already!)
    3. Utilize my desktop hardware: AMD Quad-core CPU, 4 GB DDR2 800, 2 SATA-II drives (500 GB each, RAID 1), with 24” screens.

    Create VHD for native boot

    You can either have base installation of Windows 7 and then dual-boot using VHD, or entirely boot from VHDs. I chose second option, and already have my default VHD running Windows 7 with Office 2007. When I initially prepared my first VHD using Windows AIK, I had backed it up to create new VHDs on demand. I will use this VHD to start afresh with a new VHD.

    1. Create a VHD and have it on physical partition, say D:\Virtuals\Windows7.SP2010Foundation.vhd (It is a sysprepped VHD of Windows 7)
    2. Make BCD store entry for new VHD. Sample instructions here from Sir Hanselman.
    3. Also install iReboot on this machine (and on new VHD later), so that we can quickly switch directly between VHDs from Taskbar. Not so painful for me, given fast booting of Windows 7 now.
       image
    4. Optionally, I map all my personal folders like My Docs, My Music to D:\Users\[Username] using folder properties > location. I do that for each VHD in my environment. I have only one partition, and hence C: is my VHD and D: is the system partition. This allows to use my files/projects across VHDs.
    5. Reboot the machine to new VHD/OS (“SharePoint Foundation 2010”).
    6. Use, soon to be available, SP 2010 Foundation media. Extract it to your drive, make config change to support Client-OS install. Install pre-requisites, manually. (more on it later…!)
    7. Reboot the system into SP 2010 Foundation VHD.
    8. Having extracted the media, and with pre-requisites installed, run the setup to install SP 2010 on desktop. Select standalone installation.
    9. Once installed, it will run Config Wizard – just like in 2007. This will create all databases, configuration and applications for you.
    10. Now download and install Visual Studio 2010 Beta 2.
      VS 2010 Beta 2
    11. Also you would want to install SharePoint Designer 2010, Office 2010, Visio 2010, and Project 2010… based on your needs and availability.

    Using native-boot VHD approach gives greater flexibility without any compromise of resources. Using iReboot, you can anyways switch quickly and boot into desired VHD. And don’t forget to enable new Developer Dashboard.

     

     

    I hope Microsoft (SharePoint Team) would make trial VHDs available with above/similar configuration for developers to jump-start on SP 2010 Beta in November.

    Enjoy.

    --Sharad

  • VHD Lifestyle – My SharePoint 2007/2010 Development and Home/Media-Network Setup!

    First - Many thanks to Windows 7 (and 2008 R2), there has been some very useful enhancements in my “Digital Lifestyle” recently!

    Windows Vista didn’t fly with me so well as development machine, and I’d always go back to Windows 2003… mostly for SharePoint development setup on my working desktops.

    Once Windows 7 was RTM, I was quick to jump off RC (no stability reason really). That also gave me a reason to re-look at my existing setup, which wasn’t working comfortably well for me. So without much ado, let’s see what all I have in my setup and what I did to improve, and what is perhaps missing that you can suggest I can do to further improve...

    What do I have and wanted to improve – and did?

    1. Desktop: AMD Quad CPU, 4 GB DDR2 800, 2 SATA-II drives (500 GB each, RAID 1), with a 24” screens.
    2. Server: AMD Dual CPU 64X2, 8 GB DDR2 800, 4 SATA-II drives (2X500GB RAID 1, 2X2TB RAID 1 as WHS "duplicated" storage)
    3. Laptop: A Lenovo T-61 laptop with 2 GB RAM!!! Wi-fi connected.
    4. GBit Linksys Router, with Xbox 360 Elite and Epson photo printer on it’s network.

    With this primary hardware, I wanted to maximize productivity with ease and flexibility of supporting demanding SharePoint environment needs. So I did following:

    1. Server: Setup my server as Hyper-V (on R2) and instead move my Windows Home Server (WHS) as Virtual. I also host nifty website or two (on demand) from Home (using DynDns) on a 2mbps line! (that’s almost the best in India at the minute, with unlimited bandwidth use) So I also setup a Web Server as virtual. Shared 8 GB amongst the three, with sufficient 2 GB for WHS.
    2. Desktop: I’ve either utilized hack from Bamboo solutions for setting up SharePoint on Vista, or had depended on VPC for Win 2003 SharePoint VMs in past. So I now setup Windows 7 Ultimate on desktop as prime. I also have 4 VHDs created to desired setup, and attached to boot from using BCDEdit. So when I now want to work on SharePoint exclusively, I simply re-boot quickly. (I don’t mind anymore, since its so fast!)
    3. VHD Lifestyle – I was super excited to try new support of VHDs for booting from. There has lot already been said about VHD benefits, and I referred following to get me Native Boot on Server (for Hyper-V) and multiple-boots on desktop (as in diagram). This gave me flexible and on-demand environments that I can kill and build in minutes, not hours. And I’m truly loving the flexibility.
      1. Native VHD Support in Windows 7
      2. Native Boot Scenarios: Advanced deployment – page 29 onwards
      3. Scott Hanselman talks about his lifestyle. Here and here
      4. Wim2VHD – Convert Wim to sysprepped VHD.
    4. Utilized Media Center on desktop and Extender on Xbox, with all Media content centralized and managed by WHS on 2 TB (RAID and duplicated, with self-managed full backup of all my VHDs and drives!!!). Virtual WHS maps physical TB drives.
    5. Laptop, Desktop are Windows 7, Home Server is Windows Home Server, and all others are Windows 2008 R2 (VHD boots or virtual machines).

    image

    Planned configuration… (* SP 2010 on Win 7 assumes that hack from Bamboo will be available at the time of public beta, to install on Win 7)

    image

    There is so much of goodness, and also feature completeness I now find with combination of Windows 7, 2008 R2, WHS, and updated Xbox Media networking features (with Win 7)… that Digital Lifestyle and desired dev productivity at home is certainly coming full circle! My content is now much more accessible (thanks to HomeGroup and WHS), and with a comfort that it all is being backed up. I’m still missing SSD on my laptop (or perhaps desktop as well), but RAID 1 is keeping me quite happy and works well for SharePoint.

    What am I critically missing?

    --Sharad