SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to apply storage quotas to individual sites, rather than the entire site collection?

share|improve this question
    
Can you add the tag Powershell to this thread for others to find? Thanks – Craig Pilkenton Nov 24 '09 at 16:48

No, that isn't possible. You can always break out your site into it's own site collection and using managed paths it can "look" like it's a subsite.

For example: Your main site collection might be http://intranet/usa/ and your subsite may have the url http://intranet/usa/subsite/. You can then create a explicit managed path to usa/subsite and create a new site collection there.

Now the url is the same but you'll need to take care of the navigation. At http://intranet/usa/ you just modify the top nav to point to the subsite site collection. At the subsite site collection, modify the portal url to be the parent site collection, /usa/, or come up with your own breadcrumb site map provider to do this for you.

share|improve this answer
    
The problem is that it then separates the navigation between the site collections; we need the sites that a user can access to appear in the quick launch bars and if we create a new collection these no longer update automatically. – Anonymous Nov 25 '09 at 15:19
    
Right, that's why I was saying you can create your own site map providers that display the quicklaunch, breadcrumbs, and/or top nav exactly how you want. We have our environment setup similar to how I explained above and with my custom site map providers, end users don't really know they are going to a different site collection. – Steve Lineberry Nov 25 '09 at 22:45

To enhance Steve's answer, there isn't a normal (or easy) way to do this as applying quotas is done at a Site Collection level.

But you can use either C#.NET or Powershell on one of your servers to load the SharePoint assembly's, get ahold of the site using SPWeb, then walk into the sites normally-hidden properties to update it to one of the quota's that is different than the rest of the Site Collection.

I have done this for both standard sites and MySites. I'll post the solution for this tonight.


On a SharePoint server where you have Powershell 1 or 2 installed, create a file called 'SharePoint_Site_UpdateQuota.ps1' and place the following code inside it.

## .\SharePoint_Site_UpdateQuota.ps1 "http://server_url:30002/" "personal/jsmith/" "Personal Site Higher Limit"

param( [string] $rqurdstrPath = $(Throw "--SharePoint Core Path required."), #required parameter [string] $rqurdstrPashSubweb = $(Throw "--SharePoint Path Subweb required."), #required parameter [string] $rqurdstrQuotaTemplateName = $(Throw "--SharePoint Quota Template Name required.") #required parameter
)

Write-Host "Beginning Processing--`n"

#Before#
## stsadm -o enumsites -url "http://server_url:30002/" #

#After# ## stsadm -o enumsites -url "http://server_url:30002/" #

## Global Variables ## $strDebug = "True" #"True" "False"

$strHomeDir="O:\Powershell"
$str12Hive="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\"

Write-Host "strHomeDir: $strHomeDir"
Write-Host "rqurdstrPath: $rqurdstrPath"
Write-Host "rqurdstrPashSubweb: $rqurdstrPashSubweb"
Write-Host "rqurdstrQuotaTemplateName: $rqurdstrQuotaTemplateName"

## Activating ##
Write-Host "nActivating--n"
cd $strHomeDir

## Do Work ##
# Load SharePoint assembly #
$SPFarm = [Microsoft.SharePoint.Administration.SPFarm]::Local #$SPFarm #$SPFarm.Services | Where {$_ -like "SPWebService"}
$SPFarmSPWebService = $SPFarm.Services | Where {$_ -like "SPWebService" -and $_ -notlike "*WSS_Admin*"}

Write-Host "**SPFarmSPWebService"
#$SPFarmSPWebService #$SPFarmSPWebService.QuotaTemplates

$quota = new-object Microsoft.SharePoint.Administration.SPQuotaTemplate #.default
$quotaColl = $SPFarmSPWebService.QuotaTemplates

Write-Host "**quotaColl" #$quotaColl.count
$site = ""
$subWeb = ""
$strAllowUpdate = "False"

foreach ($quotaInd in $quotaColl) {
$strQuotaIndName = [string]$quotaInd.Name
if($strQuotaIndName -eq $rqurdstrQuotaTemplateName) {
Write-Host "-$strQuotaIndName- found"
$quota = $quotaInd
$strAllowUpdate = "True"
break
}
}

$strPathMySites = $rqurdstrPath + $rqurdstrPashSubweb
write-host "strPathMySites: $strPathMySites"
if($rqurdstrPath -like ":30002") {
#For MySites
$site=new-object Microsoft.SharePoint.SPSite($strPathMySites)
}
else {
#For normal Sites
$site=new-object Microsoft.SharePoint.SPSite($rqurdstrPath) #$site.AllWebs
$subWeb = $site.OpenWeb($rqurdstrPashSubweb)
write-host "subWeb: $subWeb"
}

write-host "site: $site"
write-host "quota: $quota"

Write-Host "nnAllow Update: $strAllowUpdate"
$site.Quota
if($strAllowUpdate -eq "True") {
$site.Quota = $quota
$site.Quota
}

#For MySites
if($rqurdstrPath -notlike ":30002") {
$subWeb.Dispose()
}
$site.Dispose()

## End Processing ##
Write-Host "nEnd Processing--n"

trap [Exception] {
write-host $("tTRAPPED: " + $_.Exception.GetType().FullName)<br> write-host $("tTRAPPED: " + $_.Exception.Message)
break
}

share|improve this answer
    
Interesting... I'd like to see that solution. Thanks. – Steve Lineberry Nov 24 '09 at 15:09
    
Thanks, this sounds like exactly what we want. – Anonymous Nov 24 '09 at 15:46
    
I don't see in your code where you are updating the subsite, only the spsite object which is the site collection. – Steve Lineberry Nov 24 '09 at 17:28
    
Aye, this doesn't work. Attemping to modify the quota for a subsite just changes the quota for the entire site collection it's a member of. – Anonymous Nov 25 '09 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.