<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alonso Robles &#187; wcm</title>
	<atom:link href="http://alonsorobles.com/tag/wcm/feed/" rel="self" type="application/rss+xml" />
	<link>http://alonsorobles.com</link>
	<description>technology, academia, and other tidbits from the trenches of a boggled mind</description>
	<lastBuildDate>Wed, 18 Apr 2012 02:48:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Caution When Packaging Themes for SharePoint Products and Technologies</title>
		<link>http://alonsorobles.com/2008/07/21/caution-when-packaging-themes-for-sharepoint-products-and-technologies/</link>
		<comments>http://alonsorobles.com/2008/07/21/caution-when-packaging-themes-for-sharepoint-products-and-technologies/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 18:50:27 +0000</pubDate>
		<dc:creator>Alonso Robles</dc:creator>
				<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[Windows Sharepoint Services]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[wcm]]></category>
		<category><![CDATA[web content management]]></category>
		<category><![CDATA[wss 3.0]]></category>

		<guid isPermaLink="false">http://blogs.importchaos.com/alonsorobles/?p=86</guid>
		<description><![CDATA[Last month, I wrote up a post about how to package themes in a WSS 3.0 Solution Package (WSP file) for deployment on a SharePoint farm. After playing with this package a bit there was on problem that I encountered &#8230; <a href="http://alonsorobles.com/2008/07/21/caution-when-packaging-themes-for-sharepoint-products-and-technologies/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last month, I wrote up a post about <a title="Packaging Branding and Themes for Deployment in SharePoint Environments" href="http://blogs.importchaos.com/alonsorobles/2008/06/26/packaging-branding-and-themes-for-deployment-in-sharepoint-environments/">how to package themes in a WSS 3.0 Solution Package (WSP file) for deployment on a SharePoint farm</a>. After playing with this package a bit there was on problem that I encountered that was pretty obvious but I failed to take into consideration. The problem was that the <em>SPTHEMES.XML</em> and the <em>OOB_SPTHEMES.XML</em>files that were packaged were deleted when I retracted and deleted the solution. Afterwards, I began to experience strange behavior with themes in my SharePoint environment.</p>
<p><strong>Why did this happen?</strong></p>
<p>A few months ago, I explained <a title="Creating Solution Packages for WSS 3.0 and MOSS 2007 Deployments" href="http://blogs.importchaos.com/alonsorobles/2008/05/16/creating-solution-packages-for-wss-30-and-moss-2007-deployments/">how WSS deploys and retracts solution packages</a>. In that explanation, I explored how the WSS run-time checks the solution manifest of the solution package (WSP file) and removes any files, features, and other solution components from the file system and content databases. This includes both the <em>SPTHEMES.XML</em> and <em>OOB_SPTHEMES.XML</em> files that were specified in the solution manifest of the theme package. Take a look at the <strong>bold-ed </strong>lines in the manifest excerpt below:</p>
<blockquote><p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;?</span><span style="color: #a31515;">xml </span><span style="color: #ff0000;">version</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">1.0</span>” <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">utf-8</span>“<span style="color: #0000ff;"> ?&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Solution </span><span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>”<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">DeploymentServerType</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">ApplicationServer</span>”<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">ResetWebServer</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">TRUE</span>”<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">SolutionId</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">D250636F-0A26-4019-8425-A5232D592C10</span>“<span style="color: #0000ff;">&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFiles</span><span style="color: #0000ff;">&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><strong><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">LAYOUTS/1033/SPTHEMES.XML</span>“</strong><span style="color: #0000ff;"><strong>/&gt;<br />
  </strong></span></span><span style="font-size: 10pt; font-family: Courier New;"><strong><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">LAYOUTS/1033/OOB_SPTHEMES.XML</span>“</strong><span style="color: #0000ff;"><strong>/&gt;<br />
</strong>  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">THEMES/MYNEWTHEME/MYNEWTHEME.INF</span>“<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">THEMES/MYNEWTHEME/mossExtension.css</span>“<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>“<span style="color: #0000ff;">THEMES/MYNEWTHEME/theme.css</span>“<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;!–</span><span style="color: #008000;">Additional images and icons (gif, jpg, png files)<br />
       </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #008000;">can be added here using &lt;TemplateFile&gt; elements </span><span style="color: #0000ff;">–&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">TemplateFiles</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Solution</span><span style="color: #0000ff;">&gt;</span></span></span></span></p></blockquote>
<p>So when I retracted my theme solution, both the <em>SPTHEMES.XML</em> and <em>OOB_SPTHEMES.XML</em>files were deleted from the file system and the original SPTHEMES.XML was not restored. Luckly, I had a copy of the themes WSP file from which I extracted the <em>OOB_SPTHEMES.XML</em> file and manually copied back to the <em>12/LAYOUTS/1033 </em>directory. This resolved the odd theme behavior that my environment was experiencing.</p>
<p><strong>Lesson learned?</strong></p>
<p>If you are going to modify files in the SharePoint HIVE in an unsupported manner (such as was the case with the theme package), make sure you have a back up of the original file system files. Like we did with the <em>OOB_SPTHEMES.XML</em> file and make a note on additional steps, aside from solution retraction and deletion, that need to be taken to restore the file system to it&#8217;s original state. This means don&#8217;t just test the deployment, but also the retraction process before using this type of solution in a production environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://alonsorobles.com/2008/07/21/caution-when-packaging-themes-for-sharepoint-products-and-technologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Packaging Branding and Themes for Deployment in SharePoint Environments</title>
		<link>http://alonsorobles.com/2008/06/26/packaging-branding-and-themes-for-deployment-in-sharepoint-environments/</link>
		<comments>http://alonsorobles.com/2008/06/26/packaging-branding-and-themes-for-deployment-in-sharepoint-environments/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 17:50:13 +0000</pubDate>
		<dc:creator>Alonso Robles</dc:creator>
				<category><![CDATA[Sharepoint Server]]></category>
		<category><![CDATA[Windows Sharepoint Services]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[moss 2007]]></category>
		<category><![CDATA[wcm]]></category>
		<category><![CDATA[web content management]]></category>
		<category><![CDATA[wss 3.0]]></category>

		<guid isPermaLink="false">http://blogs.importchaos.com/alonsorobles/?p=60</guid>
		<description><![CDATA[Last week, a colleague asked me to conduct a presentation for some colleagues to discuss best practices concerning SharePoint branding and themes. The presentation was not meant to teach anyone how to create master pages, page layouts, cascading style sheets, &#8230; <a href="http://alonsorobles.com/2008/06/26/packaging-branding-and-themes-for-deployment-in-sharepoint-environments/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last week, a colleague asked me to conduct a presentation for some colleagues to discuss best practices concerning SharePoint branding and themes. The presentation was not meant to teach anyone how to create master pages, page layouts, cascading style sheets, or write web pages, but rather, how to package branding and themes for deployment in SharePoint environments As such, I did my homework and demonstrated some approaches in a two hour virtual meeting last night. The purpose of this post is to recap the approaches and practices and provide a reference to the <a href="http://alonsorobles.com/wp-content/uploads/2008/06/customtheme.zip">sample Visual Studio 2008 projects</a> that were generated during the session.</p>
<h3>Packaging SharePoint Themes</h3>
<p>SharePoint themes are an interesting feature in SharePoint that allow site owners to quickly change the appearance of colors, icons, and images buy injecting an additional style sheet that overrides some of the existing styles found in the <em>core.css</em> style sheet. Creating a custom theme involves a couple of simple steps:</p>
<ol>
<li>Creating a new folder in the 12/TEMPLATE/THEMES directory</li>
<li>Creating a <em>theme.css </em>file to override the out of the box styles defined in the <em>core.css</em> style sheet in the directory created in the previous step</li>
<li>Creating a <em>mossExtension.css </em>file which is appended to <em>theme.css</em> file to create a the actual style sheet that is actually used when viewing pages in the SharePoint site</li>
<li>Creating a <em>&lt;directory name&gt;.inf</em> file that contains some basic setup information about the theme</li>
<li>Adding all the images and icons referenced in the custom style sheets in step 2 and 3 to the new directory created in step 1</li>
<li>Modifying the <em>SPTHEMES.XML</em> file in the 12/TEMPLATE/LAYOUTS/1033 directory</li>
</ol>
<p><strong>A word of caution!</strong> Modifying the <em>SPTHEMES.XML</em> is not a recommended customization practice since this file maybe overwritten by future SharePoint service packs.</p>
<p>It&#8217;s easy enough to take an existing theme directory out of the 12/TEMPLATE/THEMES directory, make a copy of it, rename the directory, rename the INF file, edit the INF, <em>theme.css</em>, and <em>mossExtension.css</em> file to create a new theme. However, this approach is not practical in a production SharePoint farm. The practical approach is to use the WSS solution framework to create our own solution package to deploy the custom theme. For more information, I covered the <a href="http://blogs.importchaos.com/alonsorobles/2008/05/16/creating-solution-packages-for-wss-30-and-moss-2007-deployments/">creation of solution packages (WSP files) in detail</a> in a previous post. Let&#8217;s take a quick look at the solution manifest for our theme package:</p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;?</span><span style="color: #a31515;">xml </span><span style="color: #ff0000;">version</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">1.0</span>&#8221; <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">utf-8</span>&#8220;<span style="color: #0000ff;"> ?&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Solution </span><span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8221;<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">DeploymentServerType</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">ApplicationServer</span>&#8221;<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">ResetWebServer</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">TRUE</span>&#8221;<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">SolutionId</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">D250636F-0A26-4019-8425-A5232D592C10</span>&#8220;<span style="color: #0000ff;">&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFiles</span><span style="color: #0000ff;">&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">LAYOUTS/1033/SPTHEMES.XML</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">LAYOUTS/1033/OOB_SPTHEMES.XML</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">THEMES/MYNEWTHEME/MYNEWTHEME.INF</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">THEMES/MYNEWTHEME/mossExtension.css</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">TemplateFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">THEMES/MYNEWTHEME/theme.css</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;!&#8211;</span><span style="color: #008000;"> Additional images and icons (gif, jpg, png files)<br />
       </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #008000;">can be added here using &lt;TemplateFile&gt; elements </span><span style="color: #0000ff;">&#8211;&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">TemplateFiles</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Solution</span><span style="color: #0000ff;">&gt;<br />
</span></span></p>
<p>The solution includes a modified <em>SPTHEMES.XML</em> file where we added an element to define the custom theme named <em>MYNEWTHEME</em>. You can also see that we included a copy of the original <em>SPTHEMES.XML</em> file and renamed it <em>OOB_SPTHEMES.XML</em> since it&#8217;s always a good idea to have back up copy of the file we modified. Finally, you see the critical <em>MYNEWTHEME.INF</em>, <em>mossExtension.css</em>, and <em>theme.css</em> files. For the sake of brevity, additional image and icon files were excluded on purpose.</p>
<p>The WSP file was then generated using a directive file and the MAKECAB utility (<a href="http://blogs.importchaos.com/alonsorobles/2008/05/16/creating-solution-packages-for-wss-30-and-moss-2007-deployments/">directive files and the MAKECAB utility</a> are also covered in my previous post) and deployed using the STSADM utility.</p>
<h3>Packaging Branding</h3>
<p>There are many different SharePoint Products and Technologies branding techniques. In the presentation, I demonstrated how quickly and easily we can use a solution to deploy custom style sheets, master pages, and page layouts and how we can use a feature receiver to programmatically apply the branding using the object model. Again for the sake of brevity, the demonstration illustrated how a master page can be deployed and applied. However, a similar approach can be used for page layouts, cascading style sheets, XSL files, image files, and any other branding components and artifacts.</p>
<p>The solution manifest to accomplish our task is relatively basic. Here it is:</p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;?</span><span style="color: #a31515;">xml </span><span style="color: #ff0000;">version</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">1.0</span>&#8221; <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">utf-8</span>&#8220;<span style="color: #0000ff;"> ?&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Solution </span><span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8221;<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">DeploymentServerType</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">WebFrontEnd</span>&#8221;<br />
          </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">SolutionId</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">A250636F-0A26-4019-8425-A5232D592C10</span>&#8220;<span style="color: #0000ff;">&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">FeatureManifests</span><span style="color: #0000ff;">&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">FeatureManifest </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">MyBranding\feature.xml</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">FeatureManifests</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"> &lt;</span><span style="color: #a31515;">Assemblies</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">  &lt;</span><span style="color: #a31515;">Assembly </span><span style="color: #ff0000;">DeploymentTarget</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">GlobalAssemblyCache</span>&#8221;<br />
            </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">CustomThemeFeature.dll</span>&#8220;<span style="color: #0000ff;"> /&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Assemblies</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Solution</span><span style="color: #0000ff;">&gt;</span></span></p>
<p>As you can see, the solution manifest only includes a feature manifest and an assembly that will be deployed to the GAC. The assembly only contains a custom feature receiver class that programatically applies the custom master page and the custom theme discussed earlier in this post.</p>
<p>Let&#8217;s take a look at the feature manifest:</p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Feature </span><span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">Id</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">D250636F-0A26-4019-8425-A5232D592C11</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">Description</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">My custom master page feature.</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">Title</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">My Custom Branding</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">ReceiverAssembly</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">CustomThemeFeature, Version=1.0.0.0, PublicKeyToken=1ff5d2fddf39f61b, Culture=neutral</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">ReceiverClass</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">CustomThemeFeature.FeatureReceiver</span>&#8221;<br />
         </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">Scope</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">Web</span>&#8220;<span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"> &lt;</span><span style="color: #a31515;">ElementManifests</span><span style="color: #0000ff;">&gt;<br />
  </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">ElementManifest </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">elements.xml</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">  &lt;</span><span style="color: #a31515;">ElementFile </span><span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">mycustom.master</span>&#8220;<span style="color: #0000ff;">/&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"> &lt;/</span><span style="color: #a31515;">ElementManifests</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Feature</span><span style="color: #0000ff;">&gt;<br />
</span></span></p>
<p>The feature manifest is also pretty simple as it includes one element manifest and one element file. The element file is the custom master page that was created. The element manifest will declare a module that will be used to populate the master page gallery with the custom master page. An important thing to notice here is the <em>ReceiverAssembly</em> and <em>ReceiverClass</em> attributes in the <em>Feature</em> element. These attributes tell the WSS solution framework to use a custom assembly and feature receiver class to handle the feature related events. We will look at the feature receiver class in a bit. First lets take a look the element manifest:</p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Elements </span><span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8220;<span style="color: #0000ff;">&gt;<br />
 </span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;</span><span style="color: #a31515;">Module </span><span style="color: #ff0000;">Name</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">MasterPages</span>&#8220;</span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"><br />
</span><span style="color: #ff0000;">         List</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">116</span>&#8221;<br />
         </span><span style="font-size: 10pt;"><span style="font-family: Courier New;"><span style="color: #ff0000;">Url</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">_catalogs/masterpage</span>&#8220;</span><span style="color: #0000ff;"><span style="font-family: Courier New;">&gt;<br />
</span></span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">  &lt;</span><span style="color: #a31515;">File </span><span style="color: #ff0000;">Url</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">mycustom.master</span>&#8220;<span style="color: #0000ff;"><br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #ff0000;">        Type</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">GhostableInLibrary</span>&#8220;<span style="color: #0000ff;"> /&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;"> &lt;/</span><span style="color: #a31515;">Module</span><span style="color: #0000ff;">&gt;<br />
</span></span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">&lt;/</span><span style="color: #a31515;">Elements</span><span style="color: #0000ff;">&gt;</span></span></p>
<p>The element manifest is simploy responsible for populating the master page gallery with the custom master page. If our solution and feature also had custom page layouts, those can be added to the master page gallery by adding <em>File</em> child elements to the <em>Module</em> element. Additionally, we could add more modules to populate the style library with custom style sheets and/or XSL files or add other media files to other SharePoint libraries.</p>
<p>Finally let&#8217;s take a look at the custom feature receiver class:</p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">using</span> Microsoft.SharePoint;</span></p>
<p><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">namespace</span> CustomThemeFeature </span><span style="font-size: 10pt; font-family: Courier New;">{</span><span style="font-size: 10pt; font-family: Courier New;"><br />
<span style="color: #0000ff;"> public </span><span style="color: #0000ff;">class </span><span style="color: #2b91af;">FeatureReceiver</span>: SPFeatureReceiver </span><span style="font-size: 10pt; font-family: Courier New;">{<br />
  </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">public </span><span style="color: #0000ff;">override </span><span style="color: #0000ff;">void</span> FeatureActivated(SPFeatureReceiverProperties properties) </span><span style="font-size: 10pt; font-family: Courier New;">{<br />
   </span><span style="font-size: 10pt; font-family: Courier New;">SPWeb site = (SPWeb)properties.Feature.Parent;<br />
   </span><span style="font-size: 10pt; font-family: Courier New;">site.MasterUrl = <span style="color: #a31515;">&#8220;/_catalogs/masterpage/mycustom.master&#8221;</span>;<br />
   </span><span style="font-size: 10pt; font-family: Courier New;">site.CustomMasterUrl = <span style="color: #a31515;">&#8220;/_catalogs/masterpage/mycustom.master&#8221;</span>;<br />
   </span><span style="font-size: 10pt; font-family: Courier New;">site.ApplyTheme(<span style="color: #a31515;">&#8220;MYNEWTHEME&#8221;</span>);<br />
   </span><span style="font-size: 10pt; font-family: Courier New;">site.Update();<br />
  </span><span style="font-size: 10pt; font-family: Courier New;">}<br />
  </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">public </span><span style="color: #0000ff;">override </span><span style="color: #0000ff;">void</span> FeatureDeactivating(SPFeatureReceiverProperties properties) {</span><span style="font-size: 10pt; font-family: Courier New;">}<br />
  </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">public </span><span style="color: #0000ff;">override </span><span style="color: #0000ff;">void</span> FeatureInstalled(SPFeatureReceiverProperties properties) </span><span style="font-size: 10pt; font-family: Courier New;">{</span><span style="font-size: 10pt; font-family: Courier New;">}<br />
  </span><span style="font-size: 10pt; font-family: Courier New;"><span style="color: #0000ff;">public </span><span style="color: #0000ff;">override </span><span style="color: #0000ff;">void</span> FeatureUninstalling(SPFeatureReceiverProperties properties) </span><span style="font-size: 10pt; font-family: Courier New;">{</span><span style="font-size: 10pt; font-family: Courier New;">}<br />
 </span><span style="font-size: 10pt; font-family: Courier New;">}<br />
</span><span style="font-size: 10pt; font-family: Courier New;">}</span></p>
<p>The class simply takes advantage of the feature activated event and to set the values of the master pages and apply a theme to the SPWeb object where the feature is activated.</p>
<p>Similar to the custom theme discussed earlier in this post, a WSP solution file was created using a directive file and the MAKECAB utility. The solution was then deployed with the STSADM utility. The feature was installed with the STSADM utility as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://alonsorobles.com/2008/06/26/packaging-branding-and-themes-for-deployment-in-sharepoint-environments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

