Welcome to MSDN Blogs Sign in | Join | Help

Changing Quota Template Names in SharePoint V2

Quota Template is a nice feature that's very helpful for SharePoint administrators.  It helps in managing your SharePoint server and having total control over how much your site grows.

There was a request to figure-out a way to change the Quota Template name.  "Figure-out"?? Huh! what does that mean?  Quite surprisingly, there isn't a direct way to change the quota template name in SharePoint.  And that was the birth of the below hack!

SPGlobalAdmin globalAdmin = new SPGlobalAdmin();

SPGlobalConfig globalConfig = globalAdmin.Config;

SPQuotaTemplateCollection templates = globalConfig.QuotaTemplates;

foreach(SPQuotaTemplate template in templates)

{

                if(template.Name == “Personal Site”)

{

                template.Name = “Modified Personal Site”;

                template.Add(template);

                Console.WriteLine(“Quota Template name changed!!”);

                break;

}

}

 

If you have a look at the above code carefully, it looks like I’ve added a new quota template, but it's actually not the case.  However, if you try a direct template.Name = “somename” and then call the Update() method, it wouldn’t work.  The break; statement is there to break off from the loop immediately after the change is done.  Otherwise, you might see from exceptions thrown at your face J

Published Monday, August 28, 2006 11:01 PM by sridhara
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# WSS2: Changing quote on sites... after its created « Salt * Wet * Bytes

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker