Introduction
This article will teach you how to create a deployment package (WSP) file for deploying master page, page layouts, CSS, JS, XSL and Image to SharePoint site using Visual Studio. It will reduce deployment time and can easily build the solution using visual studio.
For manual deployment, needs to follow the below steps,
- Create folder in the library
- Navigate to particular folder/libraries and upload the file
- Check in and Publish file as major version
This is very basic steps and it is very easy for deploying 2 to 3 files. In case, if you have around 1000 files such as CSS -50, images - 500, JS - 100, content search webpart - 200, Master Page, Page Layout. It will take around 8 to 9 hours for deploying the files in one environment . For 3 environment, it will take around 3 days to deploy the files. Also lot of chance are there to make manual mistake while deploying the file from one environment to another. For example, if you forgot to publish any one of the JS file as major version, the page will not load properly and it very hard to find out the issue. This package will avoid these kind of issues and it will reduce the deployment time.
Background
We built a website using publishing portal site template in SharePoint 2013. It is a cross site publishing site, so we used 3 different site collection such as Authoring, Asset and Publishing sites to preview the content by author before publishing it to public website.
Authoring site- the author post their content in this site.
Asset site- this site will store the documents which used in authoring site.
Publishing site- this a public website, the content will pull from search database and display it here by using content search webpart.
Initially we didn't create any WSP file. We were struggle lot to deploying the files manually from one environment to another. We thought almost the project was failure as we used lot of content search webpart (OOTB). Why we used lot of content search webpart means its a public face website and its going to submit goggle search engine. As you aware, the goggle search engine will not load client side script so we converted all the content search webpart to render in server side and customized its style using xslt. For deploying one webpart needs to follow below steps,
- Navigate to Site Settings=>Master Page and Layouts
- Click Server Side Style sheet and upload the xsl file
- and publish its as major version
We have around 8 to 9 webparts in a single page, so we put more effort for deploying the file then development. Finally we created this package and it takes around 2 to 3 hours to setup one environment.
Create Package using Visual Studio
Follow the below steps to create a solution package
- Select File-> New Project SharePoint 2013 Empty Project
- Give proper solution name “AccountName.SharePointVersion.ProjectName”
-
Select Deploy as a farm solution option as we are going to deploy WSP file at farm level and click Finish button
-
Then solution is created and the solution look like below
-
-
Select the solution name and right click Add--> new item from drill down menu
-
Select Empty Element and give name as “CSS”
-
Once the element is created, the solution as shown below
-
-
Select CSS element, right click and paste the copied CSS file
-
-
Element.xml add file node as shown below, similarly do same process for all the CSS files
If you set Replcement=”TRUE”, the solution will replace the new version of the file even the file already exist in the specific folder. Replcement=”False” it will not update the file.
The Property node used for setting the Meta data value of the file.
- Similarly create element for other folders such as JS, Master Page and Page Layout folders. inally the solution look like below,
-
-
Create event receiver for the feature, to publish the master page and xsl file as master version
Feature Activated event receiver code,
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">public</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">override</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">void</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> FeatureActivated(SPFeatureReceiverProperties properties)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">try</font></font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPUtility</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ValidateFormDigest();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPSecurity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">RunWithElevatedPrivileges(</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">delegate</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">()</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPSite siteCollection </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPSite)properties</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Feature</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Parent;</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (siteCollection </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">!=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">null</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">using</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPWeb topLevelSite </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> siteCollection</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">OpenWeb())</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">string</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> featureId </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> properties</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Feature</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Definition</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Id</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ToString();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPFolder displayTemplateFolder </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> topLevelSite</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">GetFolder(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"_catalogs/masterpage"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">);</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (displayTemplateFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Exists)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPList parentList </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> displayTemplateFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ParentWeb</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Lists[displayTemplateFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ParentListId];</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPFileCollection files1 </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> displayTemplateFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Files;</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">var</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> templateFiles </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">from</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPFile f </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">in</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> files1</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">where</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> String</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Equals(f</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Properties[</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"FeatureId"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">] </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">as</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">string</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">, featureId, StringComparison</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">InvariantCultureIgnoreCase)</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">select</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> f;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">List</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Guid</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">></font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> guidFilesToModify </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> List</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Guid</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">></font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">();</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">foreach</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPFile file </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">in</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> templateFiles)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">guidFilesToModify</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Add(file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">UniqueId);</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">foreach</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (Guid fileId </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">in</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> guidFilesToModify)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPFile file </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> parentList</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ParentWeb</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">GetFile(fileId);</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">EditAndCheckingAndApprove(siteCollection, file);</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPFolder rootFolder </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> topLevelSite</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">RootFolder;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">rootFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">WelcomePage </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"pages/home.aspx"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">rootFolder</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Update();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">topLevelSite</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Update();</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">string</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> topLevelSite</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ServerRelativeUrl;</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">!</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">webAppRelativePath</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">EndsWith(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"/"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">))</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">+=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"/"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font face="Consolas" size="2"><font face="Consolas" size="2">siteCollection</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Features</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Add(</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> Guid(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"f6924d36-2fa8-4f0b-b16d-06b7250180fa"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">), </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">true</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">);</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">foreach</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPWeb web </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">in</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> siteCollection</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">AllWebs)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font face="Consolas" size="2"><font face="Consolas" size="2">web</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Features</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Add(</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> Guid(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">), </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">true</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">);</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font face="Consolas" size="2"><font face="Consolas" size="2">web</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">CustomMasterUrl </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">+</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"_catalogs/masterpage/customMaster.master"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">web</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Update();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">});</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">catch</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (Exception ex)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPDiagnosticsService diagSvc </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsService</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Local;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">diagSvc</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">WriteTrace(0,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsCategory(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"sample FeatureActivated Event Receiver"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">EventSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Error),</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"An exception occurred: {0}"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">object</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">[] { ex });</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
Feature deactivated event receiver and checkin function code,
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">public</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">override</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">void</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> FeatureDeactivating(SPFeatureReceiverProperties properties)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">try</font></font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPSecurity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">RunWithElevatedPrivileges(</font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">delegate</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">()</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPSite siteCollection </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPSite)properties</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Feature</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Parent;</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (siteCollection </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">!=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">null</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPWeb topLevelSite </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> siteCollection</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">RootWeb;</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">string</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> topLevelSite</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">ServerRelativeUrl;</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">!</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">webAppRelativePath</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">EndsWith(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"/"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">))</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">+=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"/"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">foreach</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (SPWeb site </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">in</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> siteCollection</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">AllWebs)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">site</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">CustomMasterUrl </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> webAppRelativePath </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">+</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"_catalogs/masterpage/seattle.master"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">site</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">SiteLogoUrl </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">string</font></font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Empty;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">site</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Update();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">});</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">catch</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (Exception ex)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPDiagnosticsService diagSvc </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsService</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Local;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">diagSvc</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">WriteTrace(0,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsCategory(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"custom Branding FeatureDeactivating Event Receiver"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">EventSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Error),</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"An exception occurred: {0}"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">object</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">[] { ex });</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">public</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">static</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">void</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> EditAndCheckingAndApprove(SPSite site, SPFile file)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">try</font></font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2"><font color="#008000" face="Consolas" size="2">
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">CheckOutType </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">==</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPFile</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">SPCheckOutType</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">None)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">CheckOut();</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">CheckIn(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"Checked in by the branding feature."</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">, SPCheckinType</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">MajorCheckIn);</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">if</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">DocumentLibrary</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">EnableModeration)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">file</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Approve(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"Approved by the branding feature."</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">);</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">catch</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> (Exception ex)</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">{</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">SPDiagnosticsService diagSvc </font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">=</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsService</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Local;</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">diagSvc</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">WriteTrace(0,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> SPDiagnosticsCategory(</font></font><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"custom Master page FeatureActivated Event Receiver"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">EventSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Error),</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">TraceSeverity</font></font><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2"><font color="#008080" face="Consolas" size="2">.</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">Monitorable,</font></font>
<font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2"><font color="#a31515" face="Consolas" size="2">"An exception occurred: {0}"</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">,</font></font>
<font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">new</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2"> </font></font><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2"><font color="#0000ff" face="Consolas" size="2">object</font></font></font><font face="Consolas" size="2"><font face="Consolas" size="2">[] { ex });</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
<font face="Consolas" size="2"><font face="Consolas" size="2">}</font></font>
History
Initial version created.