<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Maxime Bombardier - SharePoint Architecture &amp; Development : STSADM Extensions</title><link>http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx</link><description>Tags: STSADM Extensions</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Deploying resource files across a farm</title><link>http://blogs.msdn.com/maximeb/archive/2008/04/26/deploying-resource-files-across-a-farm.aspx</link><pubDate>Sat, 26 Apr 2008 16:19:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8427244</guid><dc:creator>MaximeB</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/8427244.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=8427244</wfw:commentRss><description>&lt;p&gt;I've been looking a little bit more on finding the easiest way to deploy resource files (.RESX) in the App_GlobalResources directory and I found various solutions that includes Features and Timer Jobs to synchronize these resource files.&amp;nbsp; &lt;a href="http://www.mikhaildikov.com/2007/03/sharepoint-resources-types-use-and_2163.html" target="_blank"&gt;Mikhail Dikov has a very good article&lt;/a&gt; explaining different process and types of resources.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;However, I find that having features and timer jobs that copy files aren't very elegant and also impractical when you want to add a farm server, when you extend a web application (new zone), etc.&amp;nbsp; While we could still develop something around it, I couldn't find an elegant solution.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;In fact, I think the only elegant solution would be for the WSP to deploy App_GlobalResources correctly and that'd be the end of it.&amp;nbsp; Note that you can use WSP to deploy resources in the 12 hive for all Web Applications and also "feature resources".&amp;nbsp; Since I didn't find a way to have &lt;em&gt;that&lt;/em&gt; elegant solution, I reverted to asking myself "How did we do it with out of the box Publishing Sites?".&amp;nbsp; The answer is simple, all resources in the ...12\Resources directory are &lt;strong&gt;&lt;u&gt;ALL&lt;/u&gt;&lt;/strong&gt; copied in the App_GlobalResources of each web application during the standard Web Application creation (or extension) process.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This means that simply copying your Resource files in the 12\Resources directory will automatically deploy your resources when you create a web application, extend a web application, and even when you add a server in the farm.&amp;nbsp; Now the next question was "How do I update my resource files?".&amp;nbsp; First of all, you will need to upgrade your WSP with your updated Resource files.&amp;nbsp; This will copy the RESX in the 12\Resources directory again.&amp;nbsp; After this, you will need to run "&lt;a href="http://technet.microsoft.com/en-us/library/cc261996.aspx" target="_blank"&gt;STSADM -o CopyAppBinContent&lt;/a&gt;" on all servers in the farm.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now, there are 2 things that I find "less elegant" in this solution, one that is fixable, one that depends on your architecture:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;First of all, running that command on all servers isn't fun for your automated deployment scripts since it would require either doing it manually on all servers or use a remote execution (like PSEXEC) process on all servers.&amp;nbsp; You would either use a CMD with a list of servers (not very dynamic), or create a command that lists all farm servers.&amp;nbsp; I'll outline a solution a bit further.&lt;/li&gt; &lt;li&gt;For the second, it depends how you want your architecture.&amp;nbsp; If you only have one portal, it's fine to deploy it centrally.&amp;nbsp; If you have more than one, it will depend if you "mind" if all resources are available on all web applications.&amp;nbsp; However, in an Intranet scenario, it's probably very acceptable.&amp;nbsp; If you are an ISP, I would stay away from this solution altogether and you will unfortunately have to resort to a less interesting scenario.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;What I ended up creating for executing remotely the STSADM command on all servers was of course another STSADM :)!&amp;nbsp; I'll soon create a post with the outline of this STSADM (and add the link here).&amp;nbsp; For now, the extension does the following:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Accepts a parameter with quotes that includes the command that needs to be executed on all servers.&amp;nbsp; I also noticed that you cannot have a parameters that includes "-o" between quotes so I might modify my command so that it accepts an input file that lists the command to be executed on all servers (just to be safe I can catch all parameters).&lt;/li&gt; &lt;li&gt;Retrieves the list of servers (of which the server role isn't "Invalid" like the database server)&lt;/li&gt; &lt;li&gt;For each server, I add an entry in the Central Administration's "Administrator Tasks" list that describes the command (title) with the server name in it, and in the description, I add the command to execute&lt;/li&gt; &lt;li&gt;For each server, I create a Timer Job with a schedule of SPOneTimeSchedule.&amp;nbsp; That will essentially execute the job now on each servers and they will automatically delete themselves.&lt;/li&gt; &lt;li&gt;On each server, when the Timer Job kicks in, it goes back in the Central Administration, reads the Administrator Tasks and find the entry with the "local" server name in order to read the Description column and execute the command defined there&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;br&gt;The original command also check that there isn't a timer job and task with the same name prior to executing.&amp;nbsp; Last, if the command doesn't execute successfully on a server, the task isn't deleted and stays on the Administrator Tasks list that shows on the first page of the Central Administration.&amp;nbsp; This allows to have a visual knowledge that the task didn't execute correctly.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Cheers!&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8427244" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint+Architecture+_2600_+Design/default.aspx">SharePoint Architecture &amp; Design</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Site+Definitions+and+Features/default.aspx">Site Definitions and Features</category></item><item><title>Feature Stapling is really just for out of the box site definitions</title><link>http://blogs.msdn.com/maximeb/archive/2008/03/08/feature-stapling-is-really-just-for-out-of-the-box-site-definitions.aspx</link><pubDate>Sat, 08 Mar 2008 15:02:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8112276</guid><dc:creator>MaximeB</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/8112276.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=8112276</wfw:commentRss><description>&lt;p&gt;A couple months ago, when I started reading about Feature Stapling on blogs (I don't recall the &lt;a href="http://msdn2.microsoft.com/en-us/library/bb861862.aspx" target="_blank"&gt;MSDN documentation&lt;/a&gt; having been updated at the time but it is now), not only did I think that it was a mechanism to attach a feature to a site definition (it's true) but it was also touted as a way to update a site after it has been deployed.&amp;nbsp; As a little note, Feature Stapling is basically a feature that contains FeatureSiteTemplateAssociation nodes that attaches a FeatureId to a Site Definition name and configuration.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now I have carefully worded the last sentence.&amp;nbsp; it's still true, you can use it to update a site after it has been deployed, however, what I didn't know is that Feature Stapling will ONLY work on new site that will be created.&amp;nbsp; &lt;strong&gt;Sites already created will not have the feature activated on it and will require a different process (custom).&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now that's a little bit more interesting because Feature Stapling simply adds a &amp;lt;Feature Id=... /&amp;gt; tag to site, which you can do in the ONET.xml anytime unless it's an out of the box Site Definition.&amp;nbsp; Since modifying those definitions isn't supported, Feature Stapling is then the mechanism to attach custom features to OOB definitions.&amp;nbsp; For your own custom site definitions, while you can still use stapling, you can also simply modify your custom ONET.xml and it will do the same.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now, what do you really do to attach the feature to created sites (which is really what you want to do)?&amp;nbsp; Since Feature Stapling or site definition modifications only works for future sites, you need to activate the feature "now" to all existing sites.&amp;nbsp; The best way is to create a custom STSADM extensions that will run through all sites and subsites, validate if the feature's (&lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spweb.features.aspx" target="_blank"&gt;SPWeb.Features&lt;/a&gt;) is there on the SPWeb.&amp;nbsp; If it is, keep going, otherwise, &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.spfeaturecollection.aspx" target="_blank"&gt;add the feature to the collection&lt;/a&gt; and update (and dispose) the SPWeb object.&amp;nbsp; You can use something simple in the lines of :&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt;(SPSite site = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SPSite(http:&lt;span style="color: #008000"&gt;//servername/))&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;(SPWeb web &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; site.AllWebs)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(web.Features[featureId] == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;             web.Features.Add(featureId,&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In summary, you absolutely have to use Feature Stapling on out of the box site definitions to add your custom features to it.&amp;nbsp; For your custom site definitions, you can either modify your ONET.XML file or use Stapling.&amp;nbsp; For already created sites, create an STSADM extension to activate that feature on all of them.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maxime&lt;/p&gt;
&lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8112276" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint+Architecture+_2600_+Design/default.aspx">SharePoint Architecture &amp; Design</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Site+Definitions+and+Features/default.aspx">Site Definitions and Features</category></item><item><title>Deployment lifecycle when using Site Definitions and Features (including post production day)</title><link>http://blogs.msdn.com/maximeb/archive/2008/02/23/deployment-lifecycle-when-using-site-definitions-and-features-including-post-production-day.aspx</link><pubDate>Sat, 23 Feb 2008 16:14:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7857203</guid><dc:creator>MaximeB</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/7857203.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=7857203</wfw:commentRss><description>&lt;h4&gt;&lt;strong&gt;Summary &lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;As you have noticed, I've changed my latest SharePoint focus to look at Site Definitions (and obviously Features but I played with them a lot prior to this).&amp;nbsp; The reason for this is that I was looking at the "best" way to deploy artifacts for SharePoint WCM portals.&amp;nbsp; While I had a very good working solution prior to me playing more with Site Definitions, I now think that I am ready to handle the task much better.&amp;nbsp; This is also a follow-up to a previous article : &lt;a href="http://blogs.msdn.com/maximeb/archive/2008/01/13/real-life-team-based-development-for-web-content-management-with-sharepoint-2007.aspx" target="_blank"&gt;http://blogs.msdn.com/maximeb/archive/2008/01/13/real-life-team-based-development-for-web-content-management-with-sharepoint-2007.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The reason for this is that there is no single way to deploy SharePoint artifacts.&amp;nbsp; Worst, once you deployed the first time, your original mechanism may not work anymore or if it does, it's probably not what you should use!&amp;nbsp; What I'll attempt to do here is to define a few SharePoint artifacts that we deploy in a Web Content Management scenario for both production day and post production day, as well as the deployment lifecycle for the developers pre-production-day and post-production-day.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;SharePoint artifacts we'll cover:&lt;/strong&gt;&lt;/h4&gt; &lt;ul&gt; &lt;li&gt;Master pages&lt;/li&gt; &lt;li&gt;Page Layouts&lt;/li&gt; &lt;li&gt;CSS / JavaScripts / Images (for the masterpages and layouts)&lt;/li&gt; &lt;li&gt;Site Columns &amp;amp; Site Content Types&lt;/li&gt; &lt;li&gt;Library content types association&lt;/li&gt; &lt;li&gt;Custom Lists&lt;/li&gt; &lt;li&gt;Event Handlers on libraries&lt;/li&gt; &lt;li&gt;Feature Receivers&lt;/li&gt; &lt;li&gt;Timer jobs&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;SharePoint topics discussed: &lt;/strong&gt;&lt;/h4&gt; &lt;ul&gt; &lt;li&gt;Site Definitions&lt;/li&gt; &lt;li&gt;Features&lt;/li&gt; &lt;li&gt;Variations&lt;/li&gt; &lt;li&gt;Feature Stapling&lt;/li&gt; &lt;li&gt;Timer Jobs&lt;/li&gt; &lt;li&gt;Content Deployment&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;Why Site Definitions?&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;The timing of me digging Site Definitions more and this post, &lt;a href="http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx" target="_blank"&gt;http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx&lt;/a&gt;,&amp;nbsp; from Andrew Connell was interesting.&amp;nbsp; First of all, he's right, you do not need to create a Site Definition all the time.&amp;nbsp; However, there are also general guidelines.&amp;nbsp; When you look at the Publishing portal that is available out of the box, it really looks like a good sample for reverse-engineering (and believe me, I opened it often to learn stuff!).&amp;nbsp; How often have you kept the original "Press Releases" sub-site or used "Blueband" or any other master for your site?&amp;nbsp; What Andrew mentions is that you should create your own minimal publishing site or you can take a look at this one &lt;a href="http://www.codeplex.com/features" target="_blank"&gt;here&lt;/a&gt; on CodePlex but I suggest you still take it apart with your requirements.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Also, I'm almost always in a multilingual scenario (i.e.: SharePoint Variations) and then Site Definitions takes its full meaning.&amp;nbsp; Why? well the Variation mechanism is really just a system that provision sites.&amp;nbsp; It is &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; a copy of the source site.&amp;nbsp; When the variation timer job kicks in, it will detect a new site in the source variation.&amp;nbsp; When it reads it, it takes the title, the description, the URL and the Site Template (i.e.: site definition).&amp;nbsp; Then it simply does a standard Create Site... with those parameters.&amp;nbsp; Once that is done, it will replicate only the &lt;strong&gt;publishing fields of the welcome page&lt;/strong&gt;.&amp;nbsp; Last, it will provision the other publishing pages the same way and replicate only the publishing fields on those pages.&amp;nbsp; &lt;strong&gt;Note that any customization done manually at the source, beside publishing pages and fields, will NOT be brought to the other variations.&amp;nbsp; That includes libraries undefined in the site definitions, documents or images, versioning settings, workflows, and everything else you see in the user interface that isn't a publishing field!&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I think my last sentence was obvious enough that if you customize something at the source, you will customize it again at the destination.&amp;nbsp; While there may be scenarios when you might want this, it'll be unusual and the solution is to use Site Definitions so that the provisioning brings as much as possible.&lt;/p&gt; &lt;p&gt;&lt;br&gt;I'll finish this section with an example: today, if you have a Publishing site with the OOB site definition and that your welcome pages aren't "WelcomeLinks", what do you do?&amp;nbsp; First of all, at the source, you created a new page with your layout.&amp;nbsp; Then you updated the welcome page of your site to your new page and deleted the old "default.aspx".&amp;nbsp; Now all your welcome pages are not "default.aspx" but it's no big deal.&amp;nbsp; When you created a 2nd variation label, all the default.aspx/WelcomeLinks are back and they are the welcome pages of your sites in that variation!!&amp;nbsp; So you again updated the welcome page and deleted the default.aspx.&amp;nbsp; That's not very user friendly.&amp;nbsp; Also, if you wanted to ended up renaming your custom page to "default.aspx", the variation mechanism would break when trying to provision the site since it's the name for the WelcomeLinks.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;As you can see, Site Definitions becomes a must when using variations.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;What defines a Site Definitions?&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;First of all, there is no golden rule for this but here's what I personally follow to determine if I use the same definition or a new one:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;A different welcome page layout&lt;/li&gt; &lt;li&gt;I want to pre-provision a default set of web parts in a welcome page layout&lt;/li&gt; &lt;li&gt;(f) I want to associate specific content types to libraries&lt;/li&gt; &lt;li&gt;(f) I want to allow specific page layouts creation (i.e.: a "news" only section, a "product" only section, etc.)&lt;/li&gt; &lt;li&gt;(f) I want to add special Site Actions for some sites&lt;/li&gt; &lt;li&gt;(f) I want to have a special workflow for some sites&lt;/li&gt; &lt;li&gt;(f) I want to update library settings for some sites&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;em&gt;Note that the items prefixed by "(f)" are items where the delivery mechanism is Features but they are associated in some site definitions.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Also, one note that will affect your site definition architecture are Feature Stapling.&amp;nbsp; That functionality is one of the very practical mechanism to apply a feature to a site definition.&amp;nbsp; Unfortunately, it's also "only that".&amp;nbsp; What I mean is that if you have multiple sites with the same definition, it will apply the feature on all those sites.&amp;nbsp; This is great inside a single Site Collection but when your SharePoint farm contains multiple site collections (possibly for different customers), you may not want to apply a feature to all of them.&amp;nbsp; Unfortunately, I do not personally know of a better solution than to create your Site Definitions "per site collection" only (i.e.: in the naming).&amp;nbsp; They will still likely use the same features though.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;And really, when I design Site Definitions, I created a Feature that contains all the Features that I use for ALL sites.&amp;nbsp; That way, my Site Definitions are very small and only contains the customization for that site.&amp;nbsp; Also, I suggest taking a look at this tool to read your sites definitions : &lt;a href="http://blogs.msdn.com/maximeb/archive/2008/02/16/site-definition-viewer-a-windows-net-2-0-tool-to-read-site-definition-and-features-configurations-version-0-1.aspx" target="_blank"&gt;http://blogs.msdn.com/maximeb/archive/2008/02/16/site-definition-viewer-a-windows-net-2-0-tool-to-read-site-definition-and-features-configurations-version-0-1.aspx&lt;/a&gt;.&amp;nbsp; I also created some CMD files to automate development of site definitions and they come in handy to maximize your time.&amp;nbsp; I will post them soon.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;Before taking a look at the SharePoint artifacts, I need to give you a bit of background on how we get the artifacts: We set up a MOSS server only for "web integrators".&amp;nbsp; The Site Collections in there contains the files directly in the database edited through SharePoint Designer.&amp;nbsp; We hooked up an event on the libraries that, when a check-in is done, it brings the file in a Team Foundation Server.&amp;nbsp; Then, we have someone maintaining the build process and when he get the "go" from the web integrators, he builds the feature containing the files and that is sent to the developers for updates and eventually to production.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;SharePoint artifact deployment - Master Pages - Page Layouts - CSS/JS/Images&lt;/strong&gt;&lt;/h4&gt; &lt;h4&gt;1) Pre-production "day 1"&lt;/h4&gt; &lt;p&gt;You should create a site-scoped Feature containing your master pages and other files (pages layouts and css/js/images).&amp;nbsp; Take a look at the PublishingLayouts for ideas.&amp;nbsp; When this feature is activated on a site collection, it will add the file in the libraries in a ghosted format which means that there are no customization on them.&amp;nbsp; Note that if you ever unghost it at the destination, your feature will never update the file after.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;2) Post-production "day 2+"&lt;/h4&gt; &lt;p&gt;We'll have to define some sub-scenarios but first, let's start that, yes, you &lt;strong&gt;may&lt;/strong&gt; be able to uninstall the feature and reinstall it while using the -force command but I do not recommend it.&amp;nbsp; First, as I just mentioned, if you unghosted a file, it will not be updated.&amp;nbsp; So if you plan on using this technique, make sure you test first.&amp;nbsp; Also, I had some issues with BlobCache with CSS/JS/GIF/JPG but only when they were ghosted, never when unghosted.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Scenario #1 Updates to some/all the files&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I would suggest creating an STSADM extension that update files defined in your Feature.&amp;nbsp; This extension will unghost the file and it will act as your mechanism to deploy updates.&amp;nbsp; What I use is a simple extension with an Xml input file that defines the files to update.&amp;nbsp; This file simply grows over time since I only append to it.&amp;nbsp; It gives me an added benefit with "change management" since it's not simply a build that picked up all files and sent it in the feature which may contain an update.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Scenario #2 New files&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;If you have new files, you probably have a "business reason" behind.&amp;nbsp; For a new master pages or page layout, is it only for a new type of site (i.e.: defined in a site definition) or would you like to apply it automatically on some/all sites?&amp;nbsp; That you have a new site definition or not, you are likely to have a new feature that brings the file.&amp;nbsp; This feature may contain a Feature Receiver that will do some actions with those files such as :&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Assigning the master page to some sites&lt;/li&gt; &lt;li&gt;Allowing the page layout to be created in some/all sites&lt;/li&gt; &lt;li&gt;If you have a new site definition, you may want to add it in the list of available web templates&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Once you have your feature, you may want to create another one to staple the first feature with your site definition (some or all of them).&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;For new CSS/JS/images, they are probably used by a new page layout or master to being with so they will go in the same new feature.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;3) Developers Pre/Post production day&lt;/h4&gt; &lt;p&gt;During the initial development phase "pre-production day", developers should update their environment when they need it.&amp;nbsp; Since I have everything in Team Foundation, I created special CMD/Bath files for developers that helps them clean/create a site definition with some sub-sites already pre-populated.&amp;nbsp; This is enough for most cases.&amp;nbsp; It's clean and fast and they are up and running quickly.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;"Post-production day", the site definitions will not be updated (although they can be appended), nor the features, so they should run the same script that add files in the database and install the new features.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;SharePoint artifact deployment - Site Columns and Site Content types + library association&lt;/h4&gt; &lt;h4&gt;1) Pre-production "day 1"&lt;/h4&gt; &lt;p&gt;Feature is the best mechanism to bring columns and content types.&amp;nbsp; Note that the feature has to be Site scoped so it will not bring the content types to a library unless you &lt;em&gt;manually create a page through the GUI&lt;/em&gt; or that you use a content type association feature in your site definition.&amp;nbsp; You can take a look at &lt;a href="http://www.andrewconnell.com/blog/archive/2007/10/29/My-MOSS-WCM-STSADM-custom-commands-have-been-updated.aspx" target="_blank"&gt;Andrew Connell's STSADM extension&lt;/a&gt; for a good sample of exporting your columns/content types.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;2) Post-production "day 2+"&lt;/h4&gt; &lt;p&gt;Well we learned the hard way, since the MSDN documentation wasn't available back then, that if you add a column to a content type (in a feature), a "reinstall" of the feature will only bring the new column at the Site Collection level and it will not be replicated down to each libraries using that content type.&amp;nbsp; Fortunately, the user interface works great so if you do not have many columns to add, you may simply want to document the manual update. &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;But you know I like automation ... so yes, we are also fortunate with the API and it replicates down the change as well.&amp;nbsp; An STSADM extension that adds column + associate it to a content type can be done easily so that it reads an Xml input file with all the updates since Day 1.&amp;nbsp; When it runs, if the column's already there, it simply skips it and go check if the content type contains the association to it.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;3) Developers Pre/Post production day&lt;/h4&gt; &lt;p&gt;The same process will apply for developers.&amp;nbsp; However, since the "STSADM extension" isn't created until Day 1, they may either recreate their site collection or manually add the column/content types when a change occurs.&amp;nbsp; In my case, since creating a site definition is scripted, it goes very fast.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;SharePoint artifact deployment - Custom lists&lt;/strong&gt;&lt;/h4&gt; &lt;h4&gt;1) Pre-production "day 1"&lt;/h4&gt; &lt;p&gt;A custom list is defined in a feature.&amp;nbsp; The definition contains the columns and types.&amp;nbsp; An instance of a list is defined in a Site Definition or through the user interface.&amp;nbsp; You can also populate rows of data for an instance of a list defined in the Site Definition.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;2) Post-production "day 2+"&lt;/h4&gt; &lt;p&gt;That one is tricker, you can update and reinstall the feature.&amp;nbsp; However, that will only affect new list creation.&amp;nbsp; I personally haven't gotten the need to add columns and data to a list post-production but I would likely need another little STSADM extension to update it.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;3) Developers Pre/Post production day&lt;/h4&gt; &lt;p&gt;Same process as the content types, if it's only a feature, then reinstall it.&amp;nbsp; If it's in the site definition, run the creation script.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;&lt;strong&gt;SharePoint artifact deployment - Event Handlers, Feature Receivers, and Timer Jobs&lt;/strong&gt;&lt;/h4&gt; &lt;h4&gt;1) Pre-production "day 1"&lt;/h4&gt; &lt;p&gt;All of these are class items.&amp;nbsp; You may want to run code for a specific event on a library, run code when a feature's activated, or run code through a timer job at a specific time.&amp;nbsp; All of them are also originally brought through a feature.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;2) Post-production "day 2+"&lt;/h4&gt; &lt;p&gt;Now, this can be either very easy or much harder depending on how "politically correct" you want to be.&amp;nbsp; Technically (or less politically correct), the classes are either in the BIN or the GAC, if you need to update the code, you can simply deploy them without touching anything in SharePoint (beside an application recycling or an IISRESET).&amp;nbsp; &lt;em&gt;That is, only if you kept the same assembly version.&lt;/em&gt;&amp;nbsp; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Unfortunately, if you want to be more politically correct, you'd have to change the feature, since it contains the assembly version, and reinstall it but there are cases when it seems that some references are "ghosted" somewhere in a database so it may not work.&amp;nbsp; If you want to be politically correct (and normally, we should) with assembly versions, I would strongly suggest doing tests.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h4&gt;3) Developers Pre/Post production day&lt;/h4&gt; &lt;p&gt;For pre-production day, it's easy, the version isn't likely to change much so you are good to deploy the DLL and reset IIS/app pool.&amp;nbsp; Post production day will depend on what you chose in scenario 2.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h3&gt;Content Deployment with all this&lt;/h3&gt; &lt;p&gt;As long as your site definitions, features, and assemblies are all deployed at the destination, Content Deployment will work great with your artifacts.&amp;nbsp; Sounds simple but even with all my run-ins with Content Deployment, it works good in that scenario.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Hope it helps a bit.&amp;nbsp; I know it's a bit sad that there isn't a "single scenario" and I'm still using STSADM extensions to do some updates, but remember, most of the updates are doable from either SharePoint Designer or the web user interface.&amp;nbsp; These 2 tools works good for the updates.&amp;nbsp; Unfortunately, this version of the product doesn't seem to include the fact that field WCM deployments often have a more rigid and secure environment and SPD users aren't likely to play in production or even staging.&amp;nbsp; That's when we, developers, want to automate the process and that's when we create STSADM extensions to fill the gap.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7857203" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Variations/default.aspx">Variations</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/EventHandlers/default.aspx">EventHandlers</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Content+Deployment/default.aspx">Content Deployment</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint+Architecture+_2600_+Design/default.aspx">SharePoint Architecture &amp; Design</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Site+Definitions+and+Features/default.aspx">Site Definitions and Features</category></item><item><title>Setting Major/Minor versions and Content Deployment issues</title><link>http://blogs.msdn.com/maximeb/archive/2008/02/13/setting-major-minor-versions-and-content-deployment-issues.aspx</link><pubDate>Thu, 14 Feb 2008 02:19:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7682191</guid><dc:creator>MaximeB</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/7682191.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=7682191</wfw:commentRss><description>&lt;p&gt;Just a quick heads-up when you want to limit versions in a Web Content Management scenario and you have Content Deployment set up.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;First of all, let me explain &lt;em&gt;why&lt;/em&gt; you would like to do this:&amp;nbsp; Basically, if you happen to execute routinely a Full Content Deployment, a new version of &lt;em&gt;every&lt;/em&gt; document (pages, images, document, etc.) at the destination.&amp;nbsp; Since the default library settings are set to accept unlimited major and minor versions, you will likely run into a disk space issue before long.&amp;nbsp; I noticed that on a WCM portal that was planned for about 100 MB of web content that turned out to have 600 MB quickly because not all content had been "web-ified" and was still in PDF and document.&amp;nbsp; That 600 MB was being added at each Full Content Deployment, that a modification occurred or not!&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;So now you have a fully deployed portal with 150+ sub-sites that you want to limit the versions on at least "/documents" and "/images" (and likely "/pages" as well).&amp;nbsp; At the time, we didn't know enough (or anything really) about Feature Stapling to use them so we created an STSADM extension that updates a library's versioning settings (i.e.: does it require approval, the major &amp;amp; minor versions supported, etc.).&amp;nbsp; I would suggest using Feature Stapling for yourself (with the same codebase really) since it will also affect new sites.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;To get back to the primary subject: if you set a major or a minor version limit in the GUI, apply the change, and deploy the update to the publishing farm;&amp;nbsp; then you go back and update to only have a major limit and do not support minors, the GUI will work correctly when you apply.&amp;nbsp; In fact, the "staging or authoring" farm will work correctly.&amp;nbsp; Unfortunately, when you use content deployment, it will say that you cannot set minor version limit on a library that only supports major versions!&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I happened to know that error exactly since, when creating the STSADM extension, I got that error when playing with the properties in the "wrong" order.&amp;nbsp; It seems that Content Deployment do use the right order either.&amp;nbsp; You will have to remove the version limits, use content deployment, and then update to have only major versions.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7682191" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Content+Deployment/default.aspx">Content Deployment</category></item><item><title>Missing Content Types association with variations - an STSADM extension solution</title><link>http://blogs.msdn.com/maximeb/archive/2007/10/27/missing-content-types-association-with-variations-an-stsadm-extension-solution.aspx</link><pubDate>Sat, 27 Oct 2007 15:28:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5710138</guid><dc:creator>MaximeB</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5710138.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5710138</wfw:commentRss><description>&lt;p&gt;I ran into an issue the other day where all content for most pages where missing when viewing a "target variation" (I define a variation as "target" when it's not the source variation).&amp;nbsp; After taking a closer look, we could see the titles and description, but any custom fields were missing unless the page was a System Page or an Article.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;After more investigation, I went in the Pages Library Settings and could see that the associated Content Types were only with Page &amp;amp; Article.&amp;nbsp; Now, all custom types I create are based on Page so what was happening was that only the fields available in Page were showing since it's my base type.&amp;nbsp; I could simply, even in the GUI, add the associated content type to the library and the content was showing.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Basically, while the column's data are replicated to each variations, if the content type isn't associated to a library, the library won't show data from that content type at all even if a page references it.&amp;nbsp; Obviously, creating all of those by hands would be quite a feat and so I ended up working out an STSADM extension that was reading the source variation and updating the &lt;strong&gt;ContentTypes &lt;/strong&gt;collection of each &lt;strong&gt;Pages library &lt;/strong&gt;for each variation (based on the source available content types).&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Update :&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Here's a snippet of code to &lt;strong&gt;apply Content Types on a Pages library&lt;/strong&gt;.&amp;nbsp; You will need a reference to the &lt;strong&gt;Site's content types&lt;/strong&gt; (in snippet, variable name : _publishingSiteContentTypes) which you can get by having an SPWeb on the site collection (or root web) and reading its "ContentTypes" collection:&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 800px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ApplyPagesContentTypes(SPWeb spWeb, PagesContentTypes pagesContentTypes)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     _log.WriteLine(Environment.NewLine + String.Format(&lt;span style="color: #006080"&gt;"Applying {0} Pages Document Library Content Types"&lt;/span&gt;, spWeb.Title));&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     _log.WriteLine(LogStepLineBreak);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (pagesContentTypes.Items != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         SPList pages = spWeb.Lists[&lt;span style="color: #006080"&gt;"Pages"&lt;/span&gt;];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         SPContentType contentType = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; contentTypeName = &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; pagesContentTypes.Items.Length; i++)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;             contentTypeName = ((ContentTypeName)pagesContentTypes.Items.GetValue(i)).Value &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;             SPContentType pagesContentType = pages.ContentTypes[contentTypeName];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;             contentType = _publishingSiteContentTypes[contentTypeName];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contentType != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; pagesContentType == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;                 pages.ContentTypes.Add(contentType);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;                 _log.WriteLine(&lt;span style="color: #006080"&gt;"\t"&lt;/span&gt; + contentType.Name + &lt;span style="color: #006080"&gt;" assigned"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (contentType == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;                 _log.WriteLine(&lt;span style="color: #006080"&gt;"\tError: "&lt;/span&gt; + contentTypeName + &lt;span style="color: #006080"&gt;" wasn't found in the available content types"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;         spWeb.Update();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;     _log.WriteLine(LogStepLineBreak);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maxime&lt;/p&gt;
&lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5710138" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category></item><item><title>You receive an error when you create a page, as a SharePoint Member, for the first time in a sub-site</title><link>http://blogs.msdn.com/maximeb/archive/2007/10/27/you-receive-an-error-when-you-create-a-page-as-a-sharepoint-member-for-the-first-time-in-a-sub-site.aspx</link><pubDate>Sat, 27 Oct 2007 15:19:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5709948</guid><dc:creator>MaximeB</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5709948.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5709948</wfw:commentRss><description>&lt;p&gt;We ran into a little issue the other day when using an account with only Member rights (yes yes, we are usually admins :)), we were creating a page for the first time in a sub-site and we were receiving a beautiful stack trace of nothingness.&amp;nbsp; We refreshed the page and it was working fine, the page was added.&amp;nbsp; With an account that's admin or owner, we didn't have that problem.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now, we are creating the whole site structure programmatically through an STSADM and we are setting the AvailablePageLayouts collection per web application as to limit the type of pages authors can create for each sub-site.&amp;nbsp; And I remembered an issue with Variations where the ContentTypes collection for each "target" variations weren't set correctly by the variation job.&amp;nbsp; So I guessed right, we pre-populated the ContentTypes collection for each sub-site to contain a reference of all site content types that we accept for each sub-site and the error disappeared.&amp;nbsp; Since we had the whole extension with an Xml input, it wasn't hard at that point to add "Available" ContentTypes to it.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;It's quite possible that the GUI for updating AvailablePageLayouts does that, I didn't use Reflector on it nor did I check the ContentTypes collection when using the GUI, but my guess would be that the error's a bug since if you refresh the page creation, the content type is indeed added at that point and the 2nd creation will work.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5709948" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Variations/default.aspx">Variations</category></item><item><title>Programmatically create a site lookup column in SharePoint</title><link>http://blogs.msdn.com/maximeb/archive/2007/10/27/programmatically-create-a-site-lookup-column-in-sharepoint.aspx</link><pubDate>Sat, 27 Oct 2007 15:08:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5709769</guid><dc:creator>MaximeB</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5709769.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5709769</wfw:commentRss><description>&lt;p&gt;We have automated almost everything about creating a "blank" publishing web site with landing pages, navigation parameters, even content pages.&amp;nbsp; One thing we found out with Features or even code is that you cannot create a list with its GUID; it will be provided to you after creation.&amp;nbsp; Obviously, if you have a Feature with a List and a site lookup column pointing to that list through its GUID, the feature will not work.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;So we had to break our list &amp;amp; lookup columns from our features and create them programmatically after the feature is installed (or it could be part of the Activated event if you want).&amp;nbsp; In our case, we created an STSADM extension that creates a SharePoint Custom List, add its columns, add its data rows, create site lookup columns, and add them to the specified content type.&amp;nbsp; The input's obviously an Xml file.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Down to the point, creating a Lookup Column isn't terribly different than creating a standard column where you have to add it to the site columns collection.&amp;nbsp; However, instead of using the Add method, there's also an AddLookup method.&amp;nbsp; Basically, you need an SPWeb instance and an SPList instance pointing to your list and you can add the column with this :&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; web.Fields.AddLookup(&lt;strong&gt;myNewColumnDisplayName&lt;/strong&gt;, list.ID, list.ParentWeb.ID, &lt;strong&gt;myNewColumnIsRequired&lt;/strong&gt;);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPFieldLookup lookup = (SPFieldLookup)web.Fields[&lt;strong&gt;myNewColumnDisplayName&lt;/strong&gt;];&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookup.AllowMultipleValues = &lt;strong&gt;myNewColumnAllowMultipleValues&lt;/strong&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookup.Group = &lt;strong&gt;myNewColumnGroup&lt;/strong&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookup.LookupField = &lt;strong&gt;myNewColumnLookupField&lt;/strong&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lookup.Update(&lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;/p&gt;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;I've put in bold the parameters you have to include but that's about it, you now have a site lookup column created.&amp;nbsp; Beware, you can create the column with the same display name multiple times so you will want to verify first if the column already exists.&amp;nbsp; After that, you will want to add it to content types.&lt;/font&gt;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newField = (SPField)lookup;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPContentType ct = web.ContentTypes[contentTypeName];&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;bool&lt;/span&gt; fieldLinked = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;foreach&lt;/span&gt; (SPFieldLink fieldLink &lt;span style="color: blue"&gt;in&lt;/span&gt; ct.FieldLinks)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (fieldLink.DisplayName.Equals(columnLookup.DisplayName))&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldLinked = &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if&lt;/span&gt; (!fieldLinked) {&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ct.FieldLinks.Add(&lt;span style="color: blue"&gt;new&lt;/span&gt; SPFieldLink(newField));&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ct.Update(&lt;span style="color: blue"&gt;true&lt;/span&gt;);&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;Again, you have to validate that the link isn't already there (if you plan on being able to re-run your code as I can with an STSADM.&amp;nbsp; You are now all set with your lookup columns!&lt;/font&gt;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;font face="Trebuchet MS"&gt;Maxime&lt;/font&gt;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: consolas"&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5709769" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category></item><item><title>Content Deployment : The URL "Style Library/en-us" is invalid</title><link>http://blogs.msdn.com/maximeb/archive/2007/10/10/content-deployment-the-url-style-library-en-us-is-invalid.aspx</link><pubDate>Thu, 11 Oct 2007 01:00:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5394818</guid><dc:creator>MaximeB</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5394818.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5394818</wfw:commentRss><description>&lt;p&gt;I came across this error yesterday while testing a Content Deployment for a customer and had this error "The URL "Style Library/en-US" is invalid ..." with the stack trace mentioning that it was updating a File or Folder.&amp;nbsp; The kind of message where you say "yeah I know, I'm deploying this so you should bring it up!".&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I couldn't find what was causing the issue.&amp;nbsp; For a recap, when you use first use Content Deployment (for a Publishing Site), your destination must be a "Blank Site" of the same language than the source's site collection language.&amp;nbsp; However, a coworker mentioned to me another issue he had with content deployment and the solution was to add another step prior to the first deployment :&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;For a successful Publishing Content deployment, your destination must have first created a Publishing Site collection, deleted it, and then created the Blank Site.&amp;nbsp; That will add elements to the Web Application and your Content Deployment will complete successfully after that.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I had heard of issues where Resource files weren't fully brought by the Content Deployment, that would also fix it.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5394818" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Content+Deployment/default.aspx">Content Deployment</category></item><item><title>My STSADM extension toolbox</title><link>http://blogs.msdn.com/maximeb/archive/2007/10/06/my-stsadm-extension-toolbox.aspx</link><pubDate>Sat, 06 Oct 2007 21:34:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5320345</guid><dc:creator>MaximeB</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5320345.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5320345</wfw:commentRss><description>&lt;p&gt;Here's a listing of custom STSADM extensions myself and my coworkers have created.&amp;nbsp; Feel free to ask questions regarding the namespaces for these.&amp;nbsp; I'd like to thank those who contributed to this : Stéphane Perron, Louis Fournier, and Vincent Trépanier at &lt;a href="http://www.orckestra.com"&gt;Orckestra&lt;/a&gt;, an outstanding partner for SharePoint, Biztalk, and Commerce in Montreal; and a co-worker Philippe Bédard.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;BaseStsAdmExtension&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;The basic class for all my extensions.&amp;nbsp; It adds up default classes for a common output, verbose output switch, Url switch, and a wait switch to allow a developer to attach to the process.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;ContentBuilder&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Generates all columns, content types, page layouts, style sheets, site collection images, and master pages in a Feature.&amp;nbsp; The "files" have to be exported (and we have another mechanism for that) in order to import them in another site.&amp;nbsp; This was originally taken from &lt;a href="http://andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx"&gt;http://andrewconnell.com/blog/articles/MossStsadmWcmCommands.aspx&lt;/a&gt; and then updated to fix a few issues and add more elements.&amp;nbsp; You can also find information on Features here : &lt;a title="Working with Features" href="http://msdn2.microsoft.com/ms460318.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms460318.aspx&lt;/a&gt; and here &lt;a href="http://www.codeproject.com/spoint/ExtendingSPS.asp"&gt;http://www.codeproject.com/spoint/ExtendingSPS.asp&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;PreloadWebSites&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;A simple extension that reads an input Xml file and hits all the specified Urls with HttpWebRequests.&amp;nbsp; This helps loading specific content types &amp;amp; page layouts in the JIT after you ran the &lt;a href="http://blogs.msdn.com/joelo/archive/2006/08/13/697044.aspx"&gt;Warm up scripts&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;PublishAllItems&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;An extension that will approve items in SharePoint.&amp;nbsp; It has 2 main switches, one to approve "web integrators" libraries (Master pages, Style Library, Site Collection images); and one to approve "Pages" libraries starting a given path and downward.&amp;nbsp; It will also cancel any workflow associated with the element's it's approving.&amp;nbsp; You can also take a look at the one available at &lt;a href="http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html"&gt;http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html&lt;/a&gt; as it ended up being very similar to mine.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;ResetMasterPages&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;This one I had to create to automate the master pages settings when using Content Deployment.&amp;nbsp; There is a known bug where, when doing the first Full Content Deployment, the master page parameters aren't kept at the destination.&amp;nbsp; This will bring them over.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;ListBuilder&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;This will read an input Xml file and create custom lists with custom columns.&amp;nbsp; It can also add Lookup site columns and add those columns to content types.&amp;nbsp; This was done because we used Features to add content types but found out that a list was always recreated and used a different GUID.&amp;nbsp; We couldn't provision Lookup columns to them and if we used a Feature to bring a list over, then the GUID was changing every time and causing issues with Content Deployment.&amp;nbsp; It can also provision a BDC column in the list.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;SiteBuilder&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;This extension will create a whole lot of things for a portal : sites with title/description, content pages with content (fields) values, set master pages, set available page layouts, set the content types per libraries (to fix a little bug), and set security (coming soon).&amp;nbsp; It's great when you have features for the containers/artefacts and you want to add a default&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;AddLocalFile / DeleteLocalFile&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;We needed a little help to add and remove files other than through Features.&amp;nbsp; Basically, we first had the issue when deploying updates to ItemStyles.xsl and other OOB files.&amp;nbsp; This extension was deleting the OOB files from that web site and then applying the ones from our Feature (and we needed it in ItemStyles and couldn't have a custom file).&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;AddPublishingWorkflow/RemovePublishingWorkflow&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;This one is in development;I want to be able to add and remove the Publishing workflow for all sites so that we can switch between requiring a "publish" or an "approve" through the extension.&amp;nbsp; We often want publishing only in development but an approval requirement for other environments; this extension would permit this.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;There's also a bunch of custom extensions available by Gary Lapointe at the following address : &lt;a href="http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html"&gt;http://stsadm.blogspot.com/2007/08/stsadm-commands_09.html&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I'll update this list with blog links when I create them and add new extensions.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5320345" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Variations/default.aspx">Variations</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Content+Deployment/default.aspx">Content Deployment</category></item><item><title>Listing all sites per variations - an STSADM extension solution</title><link>http://blogs.msdn.com/maximeb/archive/2007/09/24/listing-all-sites-per-variations-an-stsadm-extension-solution.aspx</link><pubDate>Tue, 25 Sep 2007 01:37:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5108077</guid><dc:creator>MaximeB</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/maximeb/comments/5108077.aspx</comments><wfw:commentRss>http://blogs.msdn.com/maximeb/commentrss.aspx?PostID=5108077</wfw:commentRss><description>&lt;p&gt;A little while ago, we ran into an issue with the Variation label creation process; it was ending successfully without creating everything.&amp;nbsp; To make matters worst, it wasn't picking the missing sites/pages with the Synchronization Timer Job.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;So it was very difficult to figure out what was missing in a particular variation except by browsing to each pages and figuring out if the page was missing.&amp;nbsp; While we only had 150 sub-sites, it could create 10 or 140 of them.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;For those interested, it seems that the issue is due to 3 things combined:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Memory leak in the variation creation process (scheduled to be fixed)  &lt;li&gt;Potential memory leak when the farm is on a VMWare virtual environment  &lt;li&gt;Not enough memory on the server :)&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Now, while waiting to have more memory and a fix, we still had to create variations correctly.&amp;nbsp; So far, we could only delete a variation and recreate it while hoping it would be done successfully.&amp;nbsp; In order to assert that we had an incorrect variation label and to what extend, I ended up creating a small STSADM extension that was simply listing each sub-sites in an Xml format along with a counter on each node to mention how many sub-sites is under.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Essentially, create a class that implements ISPStsadmCommand and in the main class, call the EnumSites method passing the output file name &amp;amp; Url.&amp;nbsp; Here's the Visual Basic.NET code excerpt : &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Private&lt;/span&gt; &lt;span style="color: blue"&gt;Function&lt;/span&gt; EnumSites(&lt;span style="color: blue"&gt;ByVal&lt;/span&gt; vOutputFile &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;String&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal&lt;/span&gt; vUrl &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;String&lt;/span&gt;) &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;String&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; output &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;String&lt;/span&gt; = &lt;span style="color: blue"&gt;String&lt;/span&gt;.Empty&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; siteMOSS &lt;span style="color: blue"&gt;As&lt;/span&gt; SPSite = &lt;span style="color: blue"&gt;Nothing&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; rootWeb &lt;span style="color: blue"&gt;As&lt;/span&gt; SPWeb = &lt;span style="color: blue"&gt;Nothing&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; publishingRootWeb &lt;span style="color: blue"&gt;As&lt;/span&gt; Publishing.PublishingWeb = &lt;span style="color: blue"&gt;Nothing&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; siteMOSS = &lt;span style="color: blue"&gt;New&lt;/span&gt; SPSite(vUrl)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootWeb = siteMOSS.OpenWeb&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; publishingRootWeb = PublishingWeb.GetPublishingWeb(rootWeb)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; xmlDoc &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;New&lt;/span&gt; XmlDocument()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; xmlDeclaration &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlDeclaration = xmlDoc.CreateXmlDeclaration(&lt;span style="color: #a31515"&gt;"1.0"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"UTF-8"&lt;/span&gt;, &lt;span style="color: blue"&gt;Nothing&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDoc.AppendChild(xmlDeclaration)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; xmlRoot &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlElement = xmlDoc.CreateElement(&lt;span style="color: #a31515"&gt;"Variations"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;For&lt;/span&gt; &lt;span style="color: blue"&gt;Each&lt;/span&gt; web &lt;span style="color: blue"&gt;As&lt;/span&gt; PublishingWeb &lt;span style="color: blue"&gt;In&lt;/span&gt; publishingRootWeb.GetPublishingWebs&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;If&lt;/span&gt; web.Label &lt;span style="color: blue"&gt;IsNot&lt;/span&gt; &lt;span style="color: blue"&gt;Nothing&lt;/span&gt; &lt;span style="color: blue"&gt;Then&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; variation &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlElement = xmlDoc.CreateElement(&lt;span style="color: #a31515"&gt;"Variation"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrSource &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = xmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"source"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrName &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = xmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"name"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrSiteCount &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = xmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"numOfSubSites"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; numOfSubSites &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;Integer&lt;/span&gt; = 0&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrSource.Value = web.Label.IsSource.ToString&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrName.Value = web.Name&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variation.Attributes.Append(attrName)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variation.Attributes.Append(attrSource)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output &amp;amp;= &lt;span style="color: #a31515"&gt;"Variation : "&lt;/span&gt; &amp;amp; web.Name &amp;amp; &lt;span style="color: #a31515"&gt;", isSource="&lt;/span&gt; &amp;amp; web.Label.IsSource.ToString &amp;amp; Environment.NewLine&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numOfSubSites += EnumSites(xmlDoc, variation, web.Web.GetSubwebsForCurrentUser(), output)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrSiteCount.Value = numOfSubSites.ToString&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; variation.Attributes.Append(attrSiteCount)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlRoot.AppendChild(variation)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;If&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Next&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDoc.AppendChild(xmlRoot)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output &amp;amp;= &lt;span style="color: #a31515"&gt;"Saving Xml output file ..."&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlDoc.Save(vOutputFile)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Return&lt;/span&gt; output&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue"&gt;As&lt;/span&gt; Exception&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output &amp;amp;= &lt;span style="color: #a31515"&gt;"Error : "&lt;/span&gt; &amp;amp; ex.Message &amp;amp; Environment.NewLine&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Finally&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;If&lt;/span&gt; siteMOSS &lt;span style="color: blue"&gt;IsNot&lt;/span&gt; &lt;span style="color: blue"&gt;Nothing&lt;/span&gt; &lt;span style="color: blue"&gt;Then&lt;/span&gt; _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; siteMOSS.Dispose()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;If&lt;/span&gt; rootWeb &lt;span style="color: blue"&gt;IsNot&lt;/span&gt; &lt;span style="color: blue"&gt;Nothing&lt;/span&gt; &lt;span style="color: blue"&gt;Then&lt;/span&gt; _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rootWeb.Dispose()&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Return&lt;/span&gt; output&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;Function&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Private&lt;/span&gt; &lt;span style="color: blue"&gt;Function&lt;/span&gt; EnumSites( _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;ByVal&lt;/span&gt; vXmlDoc &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlDocument, _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;ByVal&lt;/span&gt; vXmlParent &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlElement, _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;ByVal&lt;/span&gt; vWebs &lt;span style="color: blue"&gt;As&lt;/span&gt; SPWebCollection, _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;ByRef&lt;/span&gt; rOutput &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;String&lt;/span&gt; _&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;Integer&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; numOfSubSites &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;Integer&lt;/span&gt; = 0&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;For&lt;/span&gt; &lt;span style="color: blue"&gt;Each&lt;/span&gt; web &lt;span style="color: blue"&gt;As&lt;/span&gt; SPWeb &lt;span style="color: blue"&gt;In&lt;/span&gt; vWebs&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numOfSubSites += 1&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; site &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlElement = vXmlDoc.CreateElement(&lt;span style="color: #a31515"&gt;"Site"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrName &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = vXmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"name"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrWelcomePage &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = vXmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"welcomePage"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; attrSiteCount &lt;span style="color: blue"&gt;As&lt;/span&gt; XmlAttribute = vXmlDoc.CreateAttribute(&lt;span style="color: #a31515"&gt;"numOfSubSites"&lt;/span&gt;)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrName.Value = web.Name&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrWelcomePage.Value = PublishingWeb.GetPublishingWeb(web).DefaultPage.Name&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue"&gt;As&lt;/span&gt; Exception&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrWelcomePage.Value = &lt;span style="color: #a31515"&gt;"N/D --- "&lt;/span&gt; &amp;amp; ex.Message&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; site.Attributes.Append(attrName)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; site.Attributes.Append(attrWelcomePage)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Dim&lt;/span&gt; numofSubSubSites &lt;span style="color: blue"&gt;As&lt;/span&gt; &lt;span style="color: blue"&gt;Integer&lt;/span&gt; = EnumSites(vXmlDoc, site, web.GetSubwebsForCurrentUser, rOutput)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; numOfSubSites += numofSubSubSites&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrSiteCount.Value = numofSubSubSites.ToString&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; site.Attributes.Append(attrSiteCount)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vXmlParent.AppendChild(site)&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Next&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Catch&lt;/span&gt; ex &lt;span style="color: blue"&gt;As&lt;/span&gt; Exception&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rOutput &amp;amp;= &lt;span style="color: #a31515"&gt;"Error : "&lt;/span&gt; &amp;amp; ex.Message &amp;amp; Environment.NewLine&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;Try&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;Return&lt;/span&gt; numOfSubSites&lt;/p&gt; &lt;p style="margin: 0px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;End&lt;/span&gt; &lt;span style="color: blue"&gt;Function&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;You can essentially do the same for pages if you want to list them and do a compare with the source variation in order to list exactly what's missing, however, when we found out that the memory was the issue, we didn't extend this application so it's still in the "napkin format" :)&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Maxime&lt;/p&gt; &lt;p&gt;&lt;embed src="http://card.mygamercard.net/Mumren.swf" width="198" height="135" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"&gt;&lt;/embed&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5108077" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/maximeb/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Web+Content+Management/default.aspx">Web Content Management</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/STSADM+Extensions/default.aspx">STSADM Extensions</category><category domain="http://blogs.msdn.com/maximeb/archive/tags/Variations/default.aspx">Variations</category></item></channel></rss>