I’ve been annoyed for some time at that you cannot prohibit your users from selecting “No Quota” when creating Site Collections. Yes, you can set a default to use but the “No Quota” option is still there. Most probably you have some governance plan or similar that says that you should set quotas when creating Site Collections, but you know that sometimes you forget or somebody doesn’t even care or know what setting No Quota implies.

No Quota when creating a Site Collection

Create a feature that removes the No Quota option

But, hey - I love to write code and I was sure that you could get around it in someway. First option I thought of was creating a custom Create Site Collection page (_admin/createsite.aspx), but that’s not so beautiful right? But SharePoint has some nifty constructs that allow you to insert custom controls in most pages, called Delegate Controls. The create site collection page has one of those, so I wrote up a small control that uses the delegate control called CreateSiteCollectionPanel1 in the page I deployed to the farm.

No Quota removed

The code is pretty straight-forward; find the Drop-down list and then remove the “No Quota” option.

Code for the Delegate control:

   1: protected override void OnPreRender(EventArgs e) {
   2:     Control c = this.Parent;
   3:     if (c != null) {
   4:         c = c.Parent;
   5:         if (c != null) {
   6:             c = c.Controls[23];
   7:             if (c != null) {
   8:                 c = c.Controls[4];
   9:                 if (c != null) {
  10:                     DropDownList ddl = c.Controls[1] as DropDownList;
  11:                     if (ddl != null) {
  12:                         if (ddl.Items[0].Text == "No Quota") {
  13:                             ddl.Items.RemoveAt(0);
  14:                         }
  15:                     }
  16:                 }
  17:             }
  18:         }
  19:     }
  20: }

Code to add the Delegate control:

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   3:   <Control Id="CreateSiteCollectionPanel1"
   4:          Sequence="1"
   5:          ControlAssembly="NoQuotaLockDown, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d4d7ec0041af2eda"
   6:          ControlClass="NoQuotaLockDown.NoQuotaLockDownDelCtrl"/>
   7:  
   8: </Elements>

Download it!

You can download the full solution package here NoQuotaLockDown.wsp or the source. NoQuotaLockDownSrc.zip.

WSS vs MOSS

This solution works perfect on a Windows SharePoint Services 3.0 farm, but should not be used as-is on a Microsoft Office SharePoint Server 2007 farm. MOSS already uses this delegate control in the SharePoint Portal Server Master Site Directory Capture Control feature. This feature uses sequence 100, so you can easily create a derivative of the MOSS feature and implement the No Quota removal. Another option is to change the delegate control behavior of the create site collection page and allow the delegate control to allow more than one delegate control.