<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: SharePoint Branding Part 6 &#8211; A &quot;solution&quot; to all issues?</title>
	<atom:link href="http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/</link>
	<description>After much frustration, it seems DEFAULT is the way to go...</description>
	<lastBuildDate>Tue, 09 Mar 2010 15:24:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: MrJasper</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-15565</link>
		<dc:creator>MrJasper</dc:creator>
		<pubDate>Fri, 28 Aug 2009 19:09:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-15565</guid>
		<description>Ah if only it was quite so simple. A good series of articles, though a long way to say solutions is the answer. Anyway I happen to work for one of those big corporates and we have dozens of site collections  covering multiple divisions etc, you get the picture. So my requirement is that I dont actually care what master page your site uses as long as it inherits the masterpage from the site collection. Note Inherit not copy. So your solution helps but because it requires a filename I cant really use it. 

However you and anyone else in the same ballgame might want to check out this posting

http://msdn.microsoft.com/en-us/magazine/cc700347.aspx

This cracked it for me. Basically whats interesting from my part is this code in the receiver that gets activated everytime a site gets created

// fired whenever a new site is created
public override void FeatureActivated(SPFeatureReceiverProperties properties) {
  SPWeb ChildSite = (SPWeb)properties.Feature.Parent;
  SPWeb TopLevelSite = ChildSite.Site.RootWeb;
  ChildSite.MasterUrl = TopLevelSite.MasterUrl;
  ChildSite.CustomMasterUrl = TopLevelSite.CustomMasterUrl;
  ChildSite.AlternateCssUrl = TopLevelSite.AlternateCssUrl;
  ChildSite.SiteLogoUrl = TopLevelSite.SiteLogoUrl;
  ChildSite.Update();
}

So basically it makes a team site or non publishing site refer to the top level masterpage and css if you wish. Read the whole article as  there is a solution for replacing the application master too so you dont need to use up your space for the custom css file to apply your look and feel to all pages. 

So i can deploy any masterpage into a site collection and a new site will pick it up. An exsiting site can have it cascaded.</description>
		<content:encoded><![CDATA[<p>Ah if only it was quite so simple. A good series of articles, though a long way to say solutions is the answer. Anyway I happen to work for one of those big corporates and we have dozens of site collections  covering multiple divisions etc, you get the picture. So my requirement is that I dont actually care what master page your site uses as long as it inherits the masterpage from the site collection. Note Inherit not copy. So your solution helps but because it requires a filename I cant really use it. </p>
<p>However you and anyone else in the same ballgame might want to check out this posting</p>
<p><a href="http://msdn.microsoft.com/en-us/magazine/cc700347.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/magazine/cc700347.aspx</a></p>
<p>This cracked it for me. Basically whats interesting from my part is this code in the receiver that gets activated everytime a site gets created</p>
<p>// fired whenever a new site is created<br />
public override void FeatureActivated(SPFeatureReceiverProperties properties) {<br />
  SPWeb ChildSite = (SPWeb)properties.Feature.Parent;<br />
  SPWeb TopLevelSite = ChildSite.Site.RootWeb;<br />
  ChildSite.MasterUrl = TopLevelSite.MasterUrl;<br />
  ChildSite.CustomMasterUrl = TopLevelSite.CustomMasterUrl;<br />
  ChildSite.AlternateCssUrl = TopLevelSite.AlternateCssUrl;<br />
  ChildSite.SiteLogoUrl = TopLevelSite.SiteLogoUrl;<br />
  ChildSite.Update();<br />
}</p>
<p>So basically it makes a team site or non publishing site refer to the top level masterpage and css if you wish. Read the whole article as  there is a solution for replacing the application master too so you dont need to use up your space for the custom css file to apply your look and feel to all pages. </p>
<p>So i can deploy any masterpage into a site collection and a new site will pick it up. An exsiting site can have it cascaded.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thelastdon</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-3235</link>
		<dc:creator>thelastdon</dc:creator>
		<pubDate>Thu, 30 Oct 2008 18:35:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-3235</guid>
		<description>Thanks for the articles dude. Article 6 close the deal for me, dude this was priceless training. I&#039;m the 
brand master on my job. Sharepoint Rocks!</description>
		<content:encoded><![CDATA[<p>Thanks for the articles dude. Article 6 close the deal for me, dude this was priceless training. I&#8217;m the<br />
brand master on my job. Sharepoint Rocks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jojo</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-2832</link>
		<dc:creator>jojo</dc:creator>
		<pubDate>Wed, 01 Oct 2008 22:48:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-2832</guid>
		<description>to Brijesh H Patil --- 

try putting your spweb object into a using scope

here is a good article to explain
http://www.krokhmal.com/2006/10/05/MemoryLeaksUsingSPSObjectModel.aspx</description>
		<content:encoded><![CDATA[<p>to Brijesh H Patil &#8212; </p>
<p>try putting your spweb object into a using scope</p>
<p>here is a good article to explain<br />
<a href="http://www.krokhmal.com/2006/10/05/MemoryLeaksUsingSPSObjectModel.aspx" rel="nofollow">http://www.krokhmal.com/2006/10/05/MemoryLeaksUsingSPSObjectModel.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CleverWorkarounds &#187; SharePoint Branding - How CSS works with master pages - Part 1</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-1958</link>
		<dc:creator>CleverWorkarounds &#187; SharePoint Branding - How CSS works with master pages - Part 1</dc:creator>
		<pubDate>Sun, 31 Aug 2008 09:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-1958</guid>
		<description>[...] Links: [Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part [...]</description>
		<content:encoded><![CDATA[<p>[...] Links: [Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: max</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-834</link>
		<dc:creator>max</dc:creator>
		<pubDate>Tue, 24 Jun 2008 07:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-834</guid>
		<description>the code doesn´t work for me :/

//CleverWorkarounds.nov.dll
using System;
using System.Collections.Generic;
using Microsoft.SharePoint;

namespace CleverWorkarounds.nov
{
    public class SetDefaultMasterPage : Microsoft.SharePoint.SPFeatureReceiver //line 7
    {
        public override void FeatureActivated (SPFeatureReceiverProperties properties)
        {
            SPWeb MyCurrentWeb = properties.Feature.Parent as SPWeb;
            MyCurrentWeb.MasterUrl = &quot;/_catalogs/masterpage/nov.master&quot;;
            MyCurrentWeb.CustomMasterUrl = &quot;/_catalogs/masterpage/nov.master&quot;;
            MyCurrentWeb.AlternateCSSURL = &quot;/Style Library/nov.css&quot;;
            MyCurrentWeb.Update();
       }
    }
}

i get the error code CS0534 in line 7

can somebody help me, plz?</description>
		<content:encoded><![CDATA[<p>the code doesn´t work for me :/</p>
<p>//CleverWorkarounds.nov.dll<br />
using System;<br />
using System.Collections.Generic;<br />
using Microsoft.SharePoint;</p>
<p>namespace CleverWorkarounds.nov<br />
{<br />
    public class SetDefaultMasterPage : Microsoft.SharePoint.SPFeatureReceiver //line 7<br />
    {<br />
        public override void FeatureActivated (SPFeatureReceiverProperties properties)<br />
        {<br />
            SPWeb MyCurrentWeb = properties.Feature.Parent as SPWeb;<br />
            MyCurrentWeb.MasterUrl = &#8220;/_catalogs/masterpage/nov.master&#8221;;<br />
            MyCurrentWeb.CustomMasterUrl = &#8220;/_catalogs/masterpage/nov.master&#8221;;<br />
            MyCurrentWeb.AlternateCSSURL = &#8220;/Style Library/nov.css&#8221;;<br />
            MyCurrentWeb.Update();<br />
       }<br />
    }<br />
}</p>
<p>i get the error code CS0534 in line 7</p>
<p>can somebody help me, plz?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paisley</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-776</link>
		<dc:creator>paisley</dc:creator>
		<pubDate>Tue, 17 Jun 2008 23:57:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-776</guid>
		<description>this is hands down the best one stop shopping place for learning how to use features/solutions for branding I have EVER seen. Most of this I experinced myself before reading it - very nice to see I am not the only one who had to stumble through it pice by piece. Nice job documenting it for future reference! This is definitely a bookmarker for those times you need to refresh your memory on the details. Lots of little clarifications that I needed as well. Your writing style is very entertaining.

thanks!</description>
		<content:encoded><![CDATA[<p>this is hands down the best one stop shopping place for learning how to use features/solutions for branding I have EVER seen. Most of this I experinced myself before reading it &#8211; very nice to see I am not the only one who had to stumble through it pice by piece. Nice job documenting it for future reference! This is definitely a bookmarker for those times you need to refresh your memory on the details. Lots of little clarifications that I needed as well. Your writing style is very entertaining.</p>
<p>thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SharePoint Branding - SharePoint por Hector Insua</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-673</link>
		<dc:creator>SharePoint Branding - SharePoint por Hector Insua</dc:creator>
		<pubDate>Wed, 04 Jun 2008 22:23:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-673</guid>
		<description>[...] Links: [Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part 7]   Published Jun 04 2008, 11:23 PM by [...]</description>
		<content:encoded><![CDATA[<p>[...] Links: [Part 1, Part 2, Part 3, Part 4, Part 5, Part 6, Part 7]   Published Jun 04 2008, 11:23 PM by [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brijesh H Patil</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-476</link>
		<dc:creator>Brijesh H Patil</dc:creator>
		<pubDate>Mon, 05 May 2008 10:43:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-476</guid>
		<description>Hope you people are very excited in using the recursive function and 
forgetting to close the SPWeb and SPSite objects. As per your recursive there 
is a huge memory leakage... ha ha there comes the point... how would you handle
that Mister... well I am facing the problem with the memory leaks and sharepoint logs
is filling up ... check that and let me know with the appropriate solution...

Many Thanks,
Brijesh.</description>
		<content:encoded><![CDATA[<p>Hope you people are very excited in using the recursive function and<br />
forgetting to close the SPWeb and SPSite objects. As per your recursive there<br />
is a huge memory leakage&#8230; ha ha there comes the point&#8230; how would you handle<br />
that Mister&#8230; well I am facing the problem with the memory leaks and sharepoint logs<br />
is filling up &#8230; check that and let me know with the appropriate solution&#8230;</p>
<p>Many Thanks,<br />
Brijesh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manfred</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-359</link>
		<dc:creator>Manfred</dc:creator>
		<pubDate>Wed, 16 Apr 2008 15:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-359</guid>
		<description>Hi again!

Another small update:

When deploying the solution I posted earlier, everything went fine until I checked
the subwebs... I forgot that the folder &quot;Style Library&quot; is located in the root site
of the SPSite and is not virtual for the subwebs. So here&#039;s a better solution:
&lt;code&gt;
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite MySite = (SPSite)properties.Feature.Parent;
            SPWebCollection MyWebSites = MySite.AllWebs;

            foreach (SPWeb MyCurrentWeb in MyWebSites)
            {
                SetMaster(MyCurrentWeb, MySite);
            }

        }

        private void SetMaster(SPWeb MyWeb, SPSite MySite)
        {
            MyWeb.MasterUrl = &quot;/_catalogs/masterpage/YourMaster.master&quot;;
            MyWeb.CustomMasterUrl = &quot;/_catalogs/masterpage/YourMaster.master&quot;;
            MyWeb.AlternateCssUrl = MySite.Url+&quot;/Style Library/YourCSS.css&quot;;
            MyWeb.Update();

            if (MyWeb.Webs.Count &gt; 0)
            {
                foreach (SPWeb SubWeb in MyWeb.Webs)
                    SetMaster(SubWeb, MySite);
            }
        }
&lt;/code&gt;

Have fun!</description>
		<content:encoded><![CDATA[<p>Hi again!</p>
<p>Another small update:</p>
<p>When deploying the solution I posted earlier, everything went fine until I checked<br />
the subwebs&#8230; I forgot that the folder &#8220;Style Library&#8221; is located in the root site<br />
of the SPSite and is not virtual for the subwebs. So here&#8217;s a better solution:<br />
<code><br />
        public override void FeatureActivated(SPFeatureReceiverProperties properties)<br />
        {<br />
            SPSite MySite = (SPSite)properties.Feature.Parent;<br />
            SPWebCollection MyWebSites = MySite.AllWebs;</p>
<p>            foreach (SPWeb MyCurrentWeb in MyWebSites)<br />
            {<br />
                SetMaster(MyCurrentWeb, MySite);<br />
            }</p>
<p>        }</p>
<p>        private void SetMaster(SPWeb MyWeb, SPSite MySite)<br />
        {<br />
            MyWeb.MasterUrl = "/_catalogs/masterpage/YourMaster.master";<br />
            MyWeb.CustomMasterUrl = "/_catalogs/masterpage/YourMaster.master";<br />
            MyWeb.AlternateCssUrl = MySite.Url+"/Style Library/YourCSS.css";<br />
            MyWeb.Update();</p>
<p>            if (MyWeb.Webs.Count &gt; 0)<br />
            {<br />
                foreach (SPWeb SubWeb in MyWeb.Webs)<br />
                    SetMaster(SubWeb, MySite);<br />
            }<br />
        }<br />
</code></p>
<p>Have fun!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manfred</title>
		<link>http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/comment-page-1/#comment-356</link>
		<dc:creator>Manfred</dc:creator>
		<pubDate>Wed, 16 Apr 2008 11:04:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.cleverworkarounds.com/2007/11/10/sharepoint-branding-part-6-a-solution-to-all-issues/#comment-356</guid>
		<description>Hi there!

Great Page, great articles. I truly enjoy your way of writing. 
Just a small &quot;upgrade&quot; to your solution:
If you want to set the new Master for all Webs in your site (including the subwebs
of the subwebs and so on) you may need this method:

public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite MySite = (SPSite)properties.Feature.Parent;
            SPWebCollection MyWebSites = MySite.AllWebs;

            foreach (SPWeb MyCurrentWeb in MyWebSites)
            {
                SetMaster(MyCurrentWeb);
            }

        }

        private void SetMaster(SPWeb MyWeb)
        {
            MyWeb.MasterUrl = &quot;/_catalogs/masterpage/YourMaster.master&quot;;
            MyWeb.CustomMasterUrl = &quot;/_catalogs/masterpage/YourMaster.master&quot;;
            MyWeb.AlternateCssUrl = &quot;/Style Library/YourCSS.css&quot;;
            MyWeb.Update();

            if (MyWeb.Webs.Count &gt; 0)
            {
                foreach (SPWeb SubWeb in MyWeb.Webs)
                    SetMaster(SubWeb);
            }
        }

As you can see it contains a small recursive function that runs through the
whole site.

Hope it helps.

Greets from Germany

Manfred</description>
		<content:encoded><![CDATA[<p>Hi there!</p>
<p>Great Page, great articles. I truly enjoy your way of writing.<br />
Just a small &#8220;upgrade&#8221; to your solution:<br />
If you want to set the new Master for all Webs in your site (including the subwebs<br />
of the subwebs and so on) you may need this method:</p>
<p>public override void FeatureActivated(SPFeatureReceiverProperties properties)<br />
        {<br />
            SPSite MySite = (SPSite)properties.Feature.Parent;<br />
            SPWebCollection MyWebSites = MySite.AllWebs;</p>
<p>            foreach (SPWeb MyCurrentWeb in MyWebSites)<br />
            {<br />
                SetMaster(MyCurrentWeb);<br />
            }</p>
<p>        }</p>
<p>        private void SetMaster(SPWeb MyWeb)<br />
        {<br />
            MyWeb.MasterUrl = &#8220;/_catalogs/masterpage/YourMaster.master&#8221;;<br />
            MyWeb.CustomMasterUrl = &#8220;/_catalogs/masterpage/YourMaster.master&#8221;;<br />
            MyWeb.AlternateCssUrl = &#8220;/Style Library/YourCSS.css&#8221;;<br />
            MyWeb.Update();</p>
<p>            if (MyWeb.Webs.Count &gt; 0)<br />
            {<br />
                foreach (SPWeb SubWeb in MyWeb.Webs)<br />
                    SetMaster(SubWeb);<br />
            }<br />
        }</p>
<p>As you can see it contains a small recursive function that runs through the<br />
whole site.</p>
<p>Hope it helps.</p>
<p>Greets from Germany</p>
<p>Manfred</p>
]]></content:encoded>
	</item>
</channel>
</rss>
