<?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>Samuel {n} Mensah</title>
	<atom:link href="http://samuelnmensah.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://samuelnmensah.com</link>
	<description>The enigma of software development.</description>
	<lastBuildDate>Mon, 02 Jan 2012 09:18:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How To: Communication between UserControls</title>
		<link>http://samuelnmensah.com/2012/01/how-to-communication-between-usercontrols-2/</link>
		<comments>http://samuelnmensah.com/2012/01/how-to-communication-between-usercontrols-2/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 23:01:54 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=159</guid>
		<description><![CDATA[Problem : Allow one UserControl(DepartmentSelectorControl) to communicate /pass a value to another UserControl which will in turn &#160; using System; using System.Linq; using System.Web.UI.WebControls; public partial class Controls_DepartmentSelectorControl : System.Web.UI.UserControl { private string selecteddepartment = string.Empty; public string SelectedDepartment { get { return selecteddepartment; } set { selecteddepartment = value; &#8230; <a href="http://samuelnmensah.com/2012/01/how-to-communication-between-usercontrols-2/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong> : Allow one UserControl(DepartmentSelectorControl) to communicate /pass a value to another UserControl which will in turn</p>
<p>&nbsp;</p>
<p><span style="color: #000000;"><strong><br />
</strong></span></p>
<pre class="brush:csharp">using System;
using System.Linq;
using System.Web.UI.WebControls;

public partial class Controls_DepartmentSelectorControl : System.Web.UI.UserControl
{

	private string selecteddepartment = string.Empty;
	public string SelectedDepartment
	{
		get { return selecteddepartment; }
		set
		{
			selecteddepartment = value;
			selecteddepartment = uxDepartments.SelectedItem.Text;
		}
	}

	//Create eventhandler to be consumed by the host page
	public event EventHandler SelectDepartment;

	protected void Page_Load(object sender, EventArgs e)
	{
		using (var context = new AdventureWorksEntities())
		{

			var departments = context.Departments.Select(p =&gt; new Department
			{
				DepartmentID = p.DepartmentID,
				GroupName = p.GroupName,
				Name = p.Name,
				ModifiedDate = p.ModifiedDate
			});
			foreach (var department in departments)
			{
				var dItem = new ListItem { Text = department.Name, Value = department.DepartmentID.ToString() };
				uxDepartments.Items.Add(dItem);
			}

		}

	}

	protected void uxDepartments_SelectedIndexChanged(object sender, EventArgs e)
	{
		//Set the member variable to what the user has selected
		selecteddepartment = uxDepartments.SelectedItem.Text;
		if(SelectDepartment != null)
		{
			//Event is raised and corresponding eventhandler is called to respond to the event
			SelectDepartment(this, new EventArgs());
		}

	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2012/01/how-to-communication-between-usercontrols-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieving Editable Regions in Kentico</title>
		<link>http://samuelnmensah.com/2012/01/retrieving-editable-regions-in-kentico/</link>
		<comments>http://samuelnmensah.com/2012/01/retrieving-editable-regions-in-kentico/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 22:45:06 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Kentico CMS]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=155</guid>
		<description><![CDATA[Problem : Retrieve contents of editable regions in Kentico Kentico CMS allows you to use a custom control called CMSEditableRegion. There are times when you might need to check the contents of this region and perform some checks to implement business rules. Solution : Check for the EditableRegion property on &#8230; <a href="http://samuelnmensah.com/2012/01/retrieving-editable-regions-in-kentico/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong> : Retrieve contents of editable regions in Kentico</p>
<p>Kentico CMS allows you to use a custom control called <strong>CMSEditableRegion</strong>. There are times when you might need to check the contents of this region and perform some checks to implement business rules.</p>
<p><strong>Solution</strong> : Check for the EditableRegion property on the Current document</p>
<p>Each document has a property called EditableRegions which is basically a key value pair. If an editable region is on the page then the name (in lower case) is stored as a key in Editable Regions.</p>
<pre class="brush:csharp">if (CMSContext.CurrentDocument.DocumentContent.EditableRegions.ContainsKey("uxpagetitle"))
{
         content = CMSContext.CurrentDocument.DocumentContent.EditableRegions["uxpagetitle"].ToString();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2012/01/retrieving-editable-regions-in-kentico/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to generate an iCalendar file</title>
		<link>http://samuelnmensah.com/2012/01/how-to-generate-an-icalendar-file/</link>
		<comments>http://samuelnmensah.com/2012/01/how-to-generate-an-icalendar-file/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 22:14:59 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=149</guid>
		<description><![CDATA[Problem : Generate a iCalendar file which will trigger a calendar application (eg. outlook) to open with an updated event. The iCalendar file is a fairly common feature which most developers add to enable  users to add events to their personalized calendars via a custom calendar application Solution : Create &#8230; <a href="http://samuelnmensah.com/2012/01/how-to-generate-an-icalendar-file/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong> : Generate a iCalendar file which will trigger a calendar application (eg. outlook) to open with an updated event.</p>
<p>The iCalendar file is a fairly common feature which most developers add to enable  users to add events to their personalized calendars via a custom calendar application</p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATYAAABNCAYAAAAsLkgfAAATpklEQVR4Xu1d34tfRxU/+QuMby2K7ILLioiJGimiNmkoWytrDUVpZbGbXaWxD0vSBcG8mG9ESEHYJuxDXB82u5VAoiWmNfTHUhITq1YsNgsihhW+24CYJ936VPGhzsydud8z587Mnftrvz/u+YYk+907c2bmMzOfe86ZmTN7PhAf4A8jwAgwAiOEwB4mthHqTW4KI8AIKASY2HggMAKMwMghwMQ2cl3KDWIEGAEmNh4DjEBpBG5B58AiXEvzT8PS2x14sLQ8kfHuOsw83oVjVeWQOtzqHIDrh9+GTqXKEaGqrstwR/26hrZXwY3kZWKrEUwW1SYEElITTJaSxd31GXh8YwquXJyFj5WFYmiITbZ/BcavXIRZ0dha2l4WM0c+JrYawWRRLULASUD2ZAfAGh3WaOTvr8P4whYsL0t9ZxIWFEG40vtk3IX1mZMAUxNCRqIzTi5cgYvjq3BgEX2XrCM+SmMTWtW1a8mzaUTI3nrKNp7swoTQSa/dIRqZegZwJiXxpE2Ha9Y0y44oJrayyHG+liMgieVxWIYFr4YmyWRlXJCNIBel0XSPwdvKFtRkNanz3uoIMpLKnzBjCWH6ZejyJ5YSmcYsnMbfeyatlLO4pcuLLUPLnLBI0HQ7a2wtnwDc/JFGQJGS8bIZzUvpSJaplnw3Gg01Y7X2dUZobYB9bCEZKI9Syuh3Oy/1sfW+B8rINYuRNmlIekA629bYrE6i6mpTNdZvHqrq1lJcQdmh9luOUjyATUU9ZcVi6p0gBIhQPXLrWAuoLMSHgMJ/A6YyZqXJgE3Onn8qNRWlc3+MEhtenFAGpzZbixLbDHTnE3+YVd6DdAEElWGRrGscmrZKHkda5wCMkB6x6UkhUBOqMyRqdiNkQ1tdkHyiQfP5JjwCrPZr02EZbN+HVvMttT4ZJmh1DPkigjJxPXR+LP+aa5XJkc6YF6YO3jpGA8cJYxCQE/n6YW1a9jLYmpDP50S1pJ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LYxKooExuPLkaAERhABFJig717xfYNsRIq/u7fv1+tiG6LVdD9n9iv/k9+P5amGRsbU2m8q6ID2FiuEiPACLQDgeTkwfpLsHZJetGTz17xNzkxGvfxbtCNy86pGAFGgBGoFQGOx1YrnCyMEWAEBgEBJrZB6AWuAyPACNSKABNbrXCyMEaAERgEBMLEtkfsEePP6CHwgQxMwB9GYHQRYGIb3b71t4yJrY293qo2M7G1qrt1Y5nY2tjrrWozE1urupuJrY3d3cY28+JBG3ud28wIjDgCTGwj3sHcPEagjQgwsbWx17nNjMCII8DENuIdzM1jBNqIwP8BqocUc208iQUAAAAASUVORK5CYII=" alt="save image" /></p>
<p><strong>Solution</strong> : Create a web handler which will create a plain text file with the &#8216;ics&#8217; extension.</p>
<pre class="brush:csharp">using System;
using System.Web;
namespace MyNamespace
{
 public class iCalendar: IHttpHandler
 {

  public bool IsReusable
  {
   get
   {
    return true;
   }
  }

  string DateFormat
  {
    get
    {
      return "yyyyMMddTHHmmssZ"; // 20060215T092000Z
    }
  }

  public void ProcessRequest(HttpContext context)
  {
   DateTime startDate = DateTime.Now.AddDays(5);
   DateTime endDate = startDate.AddMinutes(35);
   string organizer = "foo@bar.com";
   string location = "My House";
   string summary = "My Event";
   string description = "Please come to\\nMy House";

   context.Response.ContentType="text/calendar";
   context.Response.AddHeader("Content-disposition", "attachment; filename=appointment.ics");

   context.Response.Write("BEGIN:VCALENDAR");
   context.Response.Write("\nVERSION:2.0");
   context.Response.Write("\nMETHOD:PUBLISH");
   context.Response.Write("\nBEGIN:VEVENT");
   context.Response.Write("\nORGANIZER:MAILTO:" + organizer);
   context.Response.Write("\nDTSTART:" + startDate.ToUniversalTime().ToString(DateFormat));
   context.Response.Write("\nDTEND:" + endDate.ToUniversalTime().ToString(DateFormat));
   context.Response.Write("\nLOCATION:" + location);
   context.Response.Write("\nUID:" + DateTime.Now.ToUniversalTime().ToString(DateFormat) + "@mysite.com");
   context.Response.Write("\nDTSTAMP:" + DateTime.Now.ToUniversalTime().ToString(DateFormat));
   context.Response.Write("\nSUMMARY:" + summary);
   context.Response.Write("\nDESCRIPTION:" + description);
   context.Response.Write("\nPRIORITY:5");
   context.Response.Write("\nCLASS:PUBLIC");
   context.Response.Write("\nEND:VEVENT");
   context.Response.Write("\nEND:VCALENDAR");
   context.Response.End();
  }
 }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2012/01/how-to-generate-an-icalendar-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feature Stapling in SharePoint 2010 Part II</title>
		<link>http://samuelnmensah.com/2011/09/feature-stapling-in-sharepoint-2010-part-ii/</link>
		<comments>http://samuelnmensah.com/2011/09/feature-stapling-in-sharepoint-2010-part-ii/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 20:44:45 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=134</guid>
		<description><![CDATA[&#160; At this point Feature 1 is complete and we are ready to deploy to our sharepoint environment. You should have a solution explorer similar to this: &#160; &#160; After you deploy, you can verify that everything worked by doing the following. Navigate to Site Actions -&#62; Site Settings -&#62; &#8230; <a href="http://samuelnmensah.com/2011/09/feature-stapling-in-sharepoint-2010-part-ii/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>At this point Feature 1 is complete and we are ready to deploy to our sharepoint environment. You should have a solution explorer similar to this:</p>
<p>&nbsp;</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview2.jpg"><img title="solutionview2" src="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview2.jpg" alt="" width="283" height="228" /></a></p>
<p>&nbsp;</p>
<p>After you deploy, you can verify that everything worked by doing the following. Navigate to Site Actions -&gt; Site Settings -&gt; Site Collection Administration -&gt; Site Collection Features. Search for the feature you deployed. You should find that it’s activated and working as expected.</p>
<p>The second thing we need to check is whether our master page was deployed or not. Navigate to  <a href="http://[rootsite]/_catalogs/master/Forms/AllItems.aspx">http://[RootSite]/_catalogs/master/Forms/AllItems.aspx</a> in your browser. You should find that Test.master (or whatever the name you gave) is now visible and approved in our master page list.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/featureadmin.jpg"><img class="alignnone size-medium wp-image-78" title="featureadmin" src="http://samuelnmensah.com/wp-content/uploads/2011/08/featureadmin-300x69.jpg" alt="" width="300" height="69" /></a></p>
<p>At this point we have feature 1 fully working. We won’t stop here because we want this master page to be applied whenever a new site collection is provisioned. So we have to create our Stapler (Feature2) which will associate Feature1 with the site definition of My sites.</p>
<p>&nbsp;</p>
<p><span style="color: #008000;">Step 3: Create Stapler Feature to associate Feature1 with a site Definition</span></p>
<p>Follows the same steps above to create another Feature called Feature 2. The scope of this feature should be set to Farm level.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/feature21.jpg"><img class="alignnone size-full wp-image-128" title="feature2" src="http://samuelnmensah.com/wp-content/uploads/2011/08/feature21.jpg" alt="" width="258" height="152" /></a></p>
<p>Next add an empty element item called Elements.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/Elements1.jpg"><img class="alignnone size-medium wp-image-129" title="Elements" src="http://samuelnmensah.com/wp-content/uploads/2011/08/Elements1-300x113.jpg" alt="" width="300" height="113" /></a></p>
<p>Your Solution explorer should like this now</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview3.jpg"><img class="alignnone size-full wp-image-88" title="solutionview3" src="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview3.jpg" alt="" width="218" height="275" /></a></p>
<p>The next task is the most important since this involves associating feature with a site definition.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/FeatureGUID.jpg"><img class="alignnone size-medium wp-image-89" title="FeatureGUID" src="http://samuelnmensah.com/wp-content/uploads/2011/08/FeatureGUID-300x52.jpg" alt="" width="300" height="52" /></a></p>
<p>We will need the GUID from Feature1 . You can find this in the manifest.</p>
<pre class="brush:xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
&lt;FeatureSiteTemplateAssociation TemplateName="SPSMSITEHOST#0" Id="493a82e4-f05b-4244-91df-c99ba69db085"&gt;&lt;/FeatureSiteTemplateAssociation&gt;
&lt;FeatureSiteTemplateAssociation TemplateName="SPSPERS#0" Id="493a82e4-f05b-4244-91df-c99ba69db085"&gt;&lt;/FeatureSiteTemplateAssociation&gt;

&lt;/Elements&gt;</pre>
<p>Two lines of code were added to make the association between feature and site defintion. The site definition id is encapsulated in the templatename [SPSMITEHOST#0 &amp; SPSPERS#0].</p>
<p>We&#8217;ve now successfully created our feature and stapler. Deploy this to your SharePoint instance to see this in action.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/09/feature-stapling-in-sharepoint-2010-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieving the current user in SharePoint 2010 object model</title>
		<link>http://samuelnmensah.com/2011/09/how-to-get-the-current-user-in-sharepoint-2010/</link>
		<comments>http://samuelnmensah.com/2011/09/how-to-get-the-current-user-in-sharepoint-2010/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 18:35:56 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=117</guid>
		<description><![CDATA[This is a really simple code snippet to obtain the current user using the SharePoint object model. using (SPWeb spweb = SPContext.Current.Web) { SPUser oUser = spweb.CurrentUser; string Username = oUser.LoginName; } SPUser represents a user in SharePoint services. A new object (oUser) is created from the spweb property, currentUser. &#8230; <a href="http://samuelnmensah.com/2011/09/how-to-get-the-current-user-in-sharepoint-2010/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a really simple code snippet to obtain the current user using the SharePoint object model.</p>
<pre class="brush:csharp">using (SPWeb spweb = SPContext.Current.Web) {
SPUser oUser = spweb.CurrentUser;
string Username = oUser.LoginName;
}</pre>
<p>SPUser represents a user in SharePoint services. A new object (oUser) is created from the spweb property, currentUser. We can now access various other properties like LoginName, Name etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/09/how-to-get-the-current-user-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free SharePoint Development Tools</title>
		<link>http://samuelnmensah.com/2011/09/free-sharepoint-development-tools/</link>
		<comments>http://samuelnmensah.com/2011/09/free-sharepoint-development-tools/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 17:56:29 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=111</guid>
		<description><![CDATA[Four free SharePoint development tools you should consider using are: CAML Builder from U2U (http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx): Build and test your CAML queries and paste into your code. CKS (Community Kit for SharePoint, Tools Edition) (http://cksdev.codeplex.com/ ): Makes the SharePoint development cycle tolerable (almost). Version 2 was released May 2011. ULS Viewer &#8230; <a href="http://samuelnmensah.com/2011/09/free-sharepoint-development-tools/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>Four free SharePoint development tools you should consider using are:</p>
<ul>
<li><strong>CAML Builder from U2U </strong>(<a href="http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx">http://www.u2u.be/Res/Tools/CamlQueryBuilder.aspx</a>): Build and test your CAML queries and paste into your code.</li>
<li><strong>CKS (Community Kit for SharePoint, Tools Edition)</strong> (<a href="http://cksdev.codeplex.com/">http://cksdev.codeplex.com/</a> ): Makes the SharePoint development cycle tolerable (almost). Version 2 was released May 2011.</li>
<li><strong>ULS Viewer </strong>(<a href="http://archive.msdn.microsoft.com/ULSViewer">http://archive.msdn.microsoft.com/ULSViewer</a> ) In my opinion, the best.</li>
<li><strong>SharePoint Manager</strong> (<a href="http://spm.codeplex.com/">http://spm.codeplex.com/</a>). Invaluable for browsing a SharePoint farm, viewing and changing parameters and option.</li>
<li><strong>SharePoint Diagnostic Studio</strong> (<a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=20022" target="_blank">http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=20022</a>) is a great tool to help administer and manage SharePoint.</li>
</ul>
<div><span style="font-size: small;"><span class="Apple-style-span" style="line-height: 24px;">source: <a href="http://nickgrattan.wordpress.com/2011/06/30/favorite-sharepoint-development-tools/#comments" target="_blank">nickGrattan</a></span></span></div>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/09/free-sharepoint-development-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Linq to SharePoint &#8211; SPLinq</title>
		<link>http://samuelnmensah.com/2011/08/using-linq-to-sharepoint-splinq/</link>
		<comments>http://samuelnmensah.com/2011/08/using-linq-to-sharepoint-splinq/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 18:38:45 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=91</guid>
		<description><![CDATA[SPlinq allows you to write strongly typed queries against lists. Here are some key points to note: SharePoint 2010 exposes list data through a REST service that you can consume in your projects. The WCF data service SharePoint exposes is ListData.svc. eg http://sp2010dev/_vti_bin/listdata.svc  You will need the ADO.NET client runtime &#8230; <a href="http://samuelnmensah.com/2011/08/using-linq-to-sharepoint-splinq/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>SPlinq allows you to write strongly typed queries against lists. Here are some key points to note:</p>
<ul>
<li>SharePoint 2010 exposes list data through a REST service that you can consume in your projects.</li>
<li>The WCF data service SharePoint exposes is ListData.svc. eg <a href="#">http://sp2010dev/_vti_bin/listdata.svc </a></li>
<li>You will need the ADO.NET client runtime installed on your machine</li>
<li>In order to use the objects returned by listdata.svc service, we&#8217;ll need to generate entity classes for the list of objects returned by that service. You can do this by using SPMetal or adding a service reference to your project.</li>
</ul>
<div><span style="font-size: small;"><span class="Apple-style-span" style="line-height: 24px;"><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/sp2010dev-_vti_bin-listdata.svc_2.png"><img class="size-medium wp-image-96 aligncenter" title="sp2010dev _vti_bin listdata.svc" src="http://samuelnmensah.com/wp-content/uploads/2011/08/sp2010dev-_vti_bin-listdata.svc_2-300x148.png" alt="" width="300" height="148" /></a></span></span></div>
<div><span style="font-size: small;"><span class="Apple-style-span" style="line-height: 24px;">The image above shows listdata.svc displayed in a browser with a view of all the lists available in that site collection.</span></span></div>
<p>After adding a service reference , include the ff references in your project:</p>
<pre class="brush:csharp">using System.Net;
using Microsoft.SharePoint.Linq</pre>
<p>You&#8217;re now ready to write a simple program. We want to create a webpart which will display a list of events only created by a particular user.</p>
<p>In the page_Load of our visual webpart we create a new data context by specifiying a URI and credentials by which we will be connecting to the list data.</p>
<pre class="brush:applescript">protected void Page_Load(object sender, EventArgs e)
		{

			var builder = new StringBuilder();
			var context = new POPDataContext(new Uri("http://sp2010dev/_vti_bin/listdata.svc"))
							  {
								  Credentials = CredentialCache.DefaultCredentials

							  };</pre>
<p>Next we retrieve the username of the current user and strip away some default characters in the string. The query below then simple selects all events which were created by that user. We loop through all the results and assign them to a string which we display in our label.</p>
<pre class="brush:csharp">SPUser currentUser = SPContext.Current.Web.CurrentUser;
			String activeDirectoryUsername = currentUser.LoginName;

			activeDirectoryUsername = activeDirectoryUsername.Substring(3);</pre>
<pre class="brush:csharp">var users =context.PopEvents.Where(b =&gt; b.CreatedBy.UserName.Equals(activeDirectoryUsername))
                                                .Select(b =&gt; new { b.Title,
                                                                   Username = b. CreatedBy.UserName
                                                                  });</pre>
<pre class="brush:csharp">foreach (var userInformationListItem in users)
			{
				builder.AppendFormat("{0} posted by {1}", userInformationListItem.Title,
									 userInformationListItem.Username);
				builder.AppendFormat("&lt;br /&gt;");
			}

			uxVacationRequests.Text = builder.ToString();

		}</pre>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong> Output:</strong></p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/Home-POP.png"><img class="alignnone size-full wp-image-108" title="Home    POP" src="http://samuelnmensah.com/wp-content/uploads/2011/08/Home-POP.png" alt="" width="255" height="62" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/08/using-linq-to-sharepoint-splinq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharepoint: Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’ to ‘System.Web.UI.IAttributeAccessor’</title>
		<link>http://samuelnmensah.com/2011/08/sharepoint-cannot-convert-type-%e2%80%98microsoft-sharepoint-webcontrols-scriptlink%e2%80%99-to-%e2%80%98system-web-ui-iattributeaccessor%e2%80%99/</link>
		<comments>http://samuelnmensah.com/2011/08/sharepoint-cannot-convert-type-%e2%80%98microsoft-sharepoint-webcontrols-scriptlink%e2%80%99-to-%e2%80%98system-web-ui-iattributeaccessor%e2%80%99/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 18:03:12 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=80</guid>
		<description><![CDATA[I recently ran into this error which working on a custom page. Sharepoint: Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’ to ‘System.Web.UI.IAttributeAccessor’ Whenever you copy a master page from one site to another in SharePoint designer, it converts certain tags to script. The solution is to cut and paste your code into a &#8230; <a href="http://samuelnmensah.com/2011/08/sharepoint-cannot-convert-type-%e2%80%98microsoft-sharepoint-webcontrols-scriptlink%e2%80%99-to-%e2%80%98system-web-ui-iattributeaccessor%e2%80%99/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently ran into this error which working on a custom page.</p>
<pre class="brush:plain">Sharepoint: Cannot convert type ‘Microsoft.SharePoint.WebControls.ScriptLink’
to ‘System.Web.UI.IAttributeAccessor’</pre>
<p>Whenever you copy a master page from one site to another in SharePoint designer, it converts certain tags to script. The solution is to cut and paste your code into a new masterpage file.</p>
<h6><em>Source: http://www.hexanes.com/?p=448</em></h6>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/08/sharepoint-cannot-convert-type-%e2%80%98microsoft-sharepoint-webcontrols-scriptlink%e2%80%99-to-%e2%80%98system-web-ui-iattributeaccessor%e2%80%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feature Stapling in SharePoint 2010 Part I</title>
		<link>http://samuelnmensah.com/2011/08/feature-stapling-in-sharepoint-2010/</link>
		<comments>http://samuelnmensah.com/2011/08/feature-stapling-in-sharepoint-2010/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 21:10:25 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=36</guid>
		<description><![CDATA[While working on an internal project recently, I was tasked to implement feature stapling which would enable us to load a custom master page to the My Site (specifically My Content) section. Before we jump into all the details I would like to define some terms just in case there &#8230; <a href="http://samuelnmensah.com/2011/08/feature-stapling-in-sharepoint-2010/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>While working on an internal project recently, I was tasked to implement feature stapling which would enable us to load a custom master page to the My Site (specifically My Content) section. Before we jump into all the details I would like to define some terms just in case there are newbies (like me) who had no idea about how to approach feature stapling.</p>
<p><strong>Feature Stapling:</strong></p>
<p>Feature stapling is a technique used in SharePoint 2010 which allows you to associate a feature (say a custom master page feature) with a site collection or web site (My sites) without modifying the site definition. In this tutorial the custom master page will be deployed to the new site collection whenever it’s provisioned for the first time.</p>
<p><strong>Feature</strong>: A SharePoint feature provides additional functionality to SharePoint. This feature can be used once deployed and activated on the SharePoint site. Technically a SharePoint feature is just an XML file (Feature.xml). In our tutorial we will create two features.</p>
<ul>
<li>The first feature (Feature1) will define the new master page we want to apply. <strong></strong></li>
<li>The second feature (Feature2) will establish the relationship between feature 1 and our site definition.<strong></strong></li>
</ul>
<p><strong>Module: </strong>A module is SharePoint template which can be used to deploy files to your SharePoint environment. We’ll create a module to deploy our custom master page.</p>
<pre class="brush:plain">Summary:

Setup project in Visual Studio
Create Feature 1 (Custom master page)
Create Stapler Feature to associate Feature1 with a site Definition</pre>
<p><span style="color: #008000;">Step 1: Setup Project</span><br />
Add a new project to your solution called ‘’MySiteFeatureStapling” and click ok.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/NewProject.jpg"><img class="alignnone size-medium wp-image-39" title="NewProject" src="http://samuelnmensah.com/wp-content/uploads/2011/08/NewProject-300x207.jpg" alt="" width="300" height="207" /></a></p>
<p>Next, select the security level for your site to “Deploy as a farm solution” and click finish. You can choose a sandboxed solution if you so choose. They should both work.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/customizationwizard.jpg"><img class="alignnone size-medium wp-image-42" title="customizationwizard" src="http://samuelnmensah.com/wp-content/uploads/2011/08/customizationwizard-300x236.jpg" alt="" width="300" height="236" /></a></p>
<p>At this point your solution explorer should look something like this.</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview.jpg"><img class="alignnone size-full wp-image-44" title="solutionview" src="http://samuelnmensah.com/wp-content/uploads/2011/08/solutionview.jpg" alt="" width="197" height="122" /></a></p>
<p>&nbsp;</p>
<p><span style="color: #008000;"> Step 2: Create Feature 1 (Custom Master Page)</span></p>
<p>Right click the Features folder and click on “Add Feature”</p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/feature1.jpg"><img class="alignnone size-medium wp-image-47" title="feature1" src="http://samuelnmensah.com/wp-content/uploads/2011/08/feature1-300x184.jpg" alt="" width="300" height="184" /></a></p>
<p>You will then be provided with the design interface of the feature designer. You can choose to rename your feature to something more meaning if you wish. You should at this point set the scope to <strong>“Site” </strong><strong>.</strong></p>
<p><a href="http://samuelnmensah.com/wp-content/uploads/2011/08/CustomPage.jpg"><img class="alignnone size-full wp-image-49" title="CustomPage" src="http://samuelnmensah.com/wp-content/uploads/2011/08/CustomPage.jpg" alt="" width="296" height="164" /></a></p>
<p><strong>Add Module</strong></p>
<p>Next, you need to right click on your project in solution explorer to add a new module. This module will be used to deploy the custom master page. Delete the sample.txt file which is provided by default and add the custom master page (in this case Test.master) you would like to deploy. Update the Elements.xml file to look like this.</p>
<pre class="brush:xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
&lt;Module Name="Module1" List="116" Url="_catalogs/masterpage"&gt;
&lt;File Path="Module1\Test.master" Url="Test.master" /&gt;
&lt;/Elements&gt;
&lt;/module&gt;</pre>
<p>The <strong>URL </strong>attribute in the module node specifies where the file will be pushed on your SharePoint server.  It&#8217;s important to note that you can add any type of file you want to the module. <strong>Add Feature Event Receiver : </strong>The Next step is to right click feature1 and add an event receiver. A new file Feature1.EventReceiver.cs is created with a bunch of commented out code. Uncomment the methods FeatureActivated &amp; FeatureDeactiving. Modify your code to look like this</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">    <span style="color: #008000;">&#91;</span>Guid<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;f5034122-c5af-4327-ad77-b52b1a107667&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Feature1EventReceiver <span style="color: #008000;">:</span> SPFeatureReceiver
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// Uncomment the method below to handle the event raised after a feature has been activated.</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureActivated<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            SPSite site <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPSite<span style="color: #008000;">;</span>
&nbsp;
            SPWeb curWeb <span style="color: #008000;">=</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">RootWeb</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//create full master url</span>
            Uri masterURI <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;/_catalogs/masterpage/Test.master&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//Master page used by all forms and pages on the site that are not published</span>
            curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">MasterUrl</span> <span style="color: #008000;">=</span> masterURI<span style="color: #008000;">.</span><span style="color: #0000FF;">AbsolutePath</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//master page used by all publishing pages on the site</span>
            curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">CustomMasterUrl</span> <span style="color: #008000;">=</span> masterURI<span style="color: #008000;">.</span><span style="color: #0000FF;">AbsolutePath</span><span style="color: #008000;">;</span>
            curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">// Uncomment the method below to handle the event raised before a feature is deactivated.</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> FeatureDeactivating<span style="color: #008000;">&#40;</span>SPFeatureReceiverProperties properties<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            SPWeb curWeb <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span>
            SPSite curSite <span style="color: #008000;">=</span> properties<span style="color: #008000;">.</span><span style="color: #0000FF;">Feature</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Parent</span> <span style="color: #0600FF; font-weight: bold;">as</span> SPSite<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>curSite <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> curWeb <span style="color: #008000;">=</span> curSite<span style="color: #008000;">.</span><span style="color: #0000FF;">RootWeb</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>curWeb <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">//Create full master url</span>
                Uri masterUri <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Uri<span style="color: #008000;">&#40;</span>curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;/_catalogs/masterpage/v4.master&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//master page used by all forms and pages on the site that are not publishing pages</span>
                curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">MasterUrl</span> <span style="color: #008000;">=</span> masterUri<span style="color: #008000;">.</span><span style="color: #0000FF;">AbsolutePath</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//master page used by all publishing pages on the site</span>
                curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">CustomMasterUrl</span> <span style="color: #008000;">=</span> masterUri<span style="color: #008000;">.</span><span style="color: #0000FF;">AbsolutePath</span><span style="color: #008000;">;</span>
                curWeb<span style="color: #008000;">.</span><span style="color: #0000FF;">Update</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Click below for the next part of this tutorial</p>
<p><a href="http://samuelnmensah.com/?p=134">Feature Stapling in SharePoint 2010 Part II</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/08/feature-stapling-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site collection codes in Sharepoint 2010</title>
		<link>http://samuelnmensah.com/2011/08/site-collection-codes-in-sharepoint-2010/</link>
		<comments>http://samuelnmensah.com/2011/08/site-collection-codes-in-sharepoint-2010/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 18:45:50 +0000</pubDate>
		<dc:creator>Samuel</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://samuelnmensah.com/?p=27</guid>
		<description><![CDATA[&#160; SharePoint 2010 ships with many in built templates. As a developer, you might come across the need to reference these  values somewhere down the line. I&#8217;ve provided a list of the codes below. These are also available here .Please note that the Global template value can also be used as just &#8220;GLOBAL&#8221; &#8230; <a href="http://samuelnmensah.com/2011/08/site-collection-codes-in-sharepoint-2010/"> Continue reading <span class="meta-nav">&#8594; </span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>SharePoint 2010 ships with many in built templates. As a developer, you might come across the need to reference these  values somewhere down the line. I&#8217;ve provided a list of the codes below. These are also available <a href="http://technet.microsoft.com/en-us/library/ff678213.aspx" target="_blank">here</a> .Please note that the Global template value can also be used as just &#8220;GLOBAL&#8221; instead of &#8220;GLOBAL#0&#8243;.</p>
<p>Example:</p>
<pre class="brush:xml">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt;
  &lt;FeatureSiteTemplateAssociation TemplateName="GLOBAL" Id="944d6e47-db98-431b-a0b4-fcd08ed6bd40"&gt;&lt;/FeatureSiteTemplateAssociation&gt;

&lt;/Elements&gt;</pre>
<p>&nbsp;</p>
<table>
<tbody>
<tr>
<td>
<h3 style="text-align: center;"><strong>Parameter value</strong></h3>
</td>
<td>
<h3 style="text-align: center;"><strong>Description</strong></h3>
</td>
</tr>
<tr>
<td>GLOBAL#0</td>
<td>Global template</td>
</tr>
<tr>
<td>STS#0</td>
<td>Team Site</td>
</tr>
<tr>
<td>STS#1</td>
<td>Blank Site</td>
</tr>
<tr>
<td>STS#2</td>
<td>Document Workspace</td>
</tr>
<tr>
<td>MPS#0</td>
<td>Basic Meeting Workspace</td>
</tr>
<tr>
<td>MPS#1</td>
<td>Blank Meeting Workspace</td>
</tr>
<tr>
<td>MPS#2</td>
<td>Decision Meeting Workspace</td>
</tr>
<tr>
<td>MPS#3</td>
<td>Social Meeting Workspace</td>
</tr>
<tr>
<td>MPS#4</td>
<td>Multipage Meeting Workspace</td>
</tr>
<tr>
<td>CENTRALADMIN#0</td>
<td>Central Admin Site</td>
</tr>
<tr>
<td>WIKI#0</td>
<td>Wiki Site</td>
</tr>
<tr>
<td>BLOG#0</td>
<td>Blog</td>
</tr>
<tr>
<td>SGS#0</td>
<td>Group Work Site</td>
</tr>
<tr>
<td>TENANTADMIN#0</td>
<td>Tenant Admin Site</td>
</tr>
<tr>
<td>ACCSRV#0</td>
<td>Access Services Site</td>
</tr>
<tr>
<td>ACCSRV#1</td>
<td>Assets Web Database</td>
</tr>
<tr>
<td>ACCSRV#3</td>
<td>Charitable Contributions Web Database</td>
</tr>
<tr>
<td>ACCSRV#4</td>
<td>Contacts Web Database</td>
</tr>
<tr>
<td>ACCSRV#6</td>
<td>Issues Web Database</td>
</tr>
<tr>
<td>ACCSRV#5</td>
<td>Projects Web Database</td>
</tr>
<tr>
<td>BDR#0</td>
<td>Document Center</td>
</tr>
<tr>
<td>OFFILE#0</td>
<td>(obsolete) Records Center</td>
</tr>
<tr>
<td>OFFILE#1</td>
<td>Records Center</td>
</tr>
<tr>
<td>OSRV#0</td>
<td>Shared Services Administration Site</td>
</tr>
<tr>
<td>PPSMASite#0</td>
<td>PerformancePoint</td>
</tr>
<tr>
<td>BICenterSite#0</td>
<td>Business Intelligence Center</td>
</tr>
<tr>
<td>PWA#0</td>
<td>Project Web App Site</td>
</tr>
<tr>
<td>PWS#0</td>
<td>Microsoft Project Site</td>
</tr>
<tr>
<td>SPS#0</td>
<td>SharePoint Portal Server Site</td>
</tr>
<tr>
<td>SPSPERS#0</td>
<td>SharePoint Portal Server Personal Space</td>
</tr>
<tr>
<td>SPSMSITE#0</td>
<td>Personalization Site</td>
</tr>
<tr>
<td>SPSTOC#0</td>
<td>Contents area Template</td>
</tr>
<tr>
<td>SPSTOPIC#0</td>
<td>Topic area template</td>
</tr>
<tr>
<td>SPSNEWS#0</td>
<td>News Site</td>
</tr>
<tr>
<td>CMSPUBLISHING#0</td>
<td>Publishing Site</td>
</tr>
<tr>
<td>BLANKINTERNET#0</td>
<td>Publishing Site</td>
</tr>
<tr>
<td>BLANKINTERNET#1</td>
<td>Press Releases Site</td>
</tr>
<tr>
<td>BLANKINTERNET#2</td>
<td>Publishing Site with Workflow</td>
</tr>
<tr>
<td>SPSNHOME#0</td>
<td>News Site</td>
</tr>
<tr>
<td>SPSSITES#0</td>
<td>Site Directory</td>
</tr>
<tr>
<td>SPSCOMMU#0</td>
<td>Community area template</td>
</tr>
<tr>
<td>SPSREPORTCENTER#0</td>
<td>Report Center</td>
</tr>
<tr>
<td>SPSPORTAL#0</td>
<td>Collaboration Portal</td>
</tr>
<tr>
<td>SRCHCEN#0</td>
<td>Enterprise Search Center</td>
</tr>
<tr>
<td>PROFILES#0</td>
<td>Profiles</td>
</tr>
<tr>
<td>BLANKINTERNETCONT</td>
<td>Publishing Portal</td>
</tr>
<tr>
<td>SPSMSITEHOST#0</td>
<td>My Site Host</td>
</tr>
<tr>
<td>ENTERWIKI#0</td>
<td>Enterprise Wiki</td>
</tr>
<tr>
<td>SRCHCENTERLITE#0</td>
<td>Basic Search Center</td>
</tr>
<tr>
<td>SRCHCENTERLITE#1</td>
<td>Basic Search Center</td>
</tr>
<tr>
<td>SRCHCENTERFAST#0</td>
<td>FAST Search Center</td>
</tr>
<tr>
<td>visprus#0</td>
<td>Visio Process Repository</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://samuelnmensah.com/2011/08/site-collection-codes-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

