<?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>DevExpertise &#187; Object Model</title>
	<atom:link href="http://www.devexpertise.com/category/sharepoint/object-model-sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devexpertise.com</link>
	<description>Practical tips and tricks for all things .NET, SharePoint, Silverlight, InfoPath, and general application development.</description>
	<lastBuildDate>Wed, 12 May 2010 14:32:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SharePoint Tip/Trick: Specifying a Relative Portal Site Connection Link</title>
		<link>http://www.devexpertise.com/2009/05/05/sharepoint-tiptrick-specifying-a-relative-portal-site-connection-link/</link>
		<comments>http://www.devexpertise.com/2009/05/05/sharepoint-tiptrick-specifying-a-relative-portal-site-connection-link/#comments</comments>
		<pubDate>Tue, 05 May 2009 17:35:56 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/2009/05/05/sharepoint-tiptrick-specifying-a-relative-portal-site-connection-link/</guid>
		<description><![CDATA[There are a variety of reasons why you’d want to create multiple site collections – to avoid recommended capacity limits, to provide a logical site structure, etc.&#160; One of the drawbacks with creating multiple site collections is the lack of out-of-the-box functionality to access and share content across site collections.&#160; While portal site connections don’t [...]]]></description>
			<content:encoded><![CDATA[<p>There are a variety of reasons why you’d want to create multiple site collections – to avoid recommended capacity limits, to provide a logical site structure, etc.&#160; One of the drawbacks with creating multiple site collections is the lack of out-of-the-box functionality to access and share content across site collections.&#160; While portal site connections don’t do anything to access or pull content, it does allow you to specify a “connection” to another site collection, which appears in the global breadcrumb.&#160; This makes logical navigation easier.&#160; Consider the following example:&#160; a company needs to have separate site collections for each department (HR, accounting, IT, etc.), but there is also a “top-level”, shared area of the environment, which will be a separate site collection.&#160; When you’re in each of the departmental site collections, it would make sense to have a link back to the top-level site collection, to insinuate a logical hierarchy. Simply put, a portal site connection gives you a breadcrumb link to another site collection.</p>
<p>Let’s take a look at the above example.&#160; I created a root site collection (<em>http://intranet.devexpertise.com</em>), and also an accounting site collection (<em>http://intranet.devexpertise.com/sites/accounting</em>). When you’re on the accounting site collection, there’s no visual indication or link back to the “root” site collection:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb.png" width="447" height="181" /></a> </p>
<p>By simply adding a portal site connection, we can provide a visual indication of the logical hierarchy and link back to the root site collection.&#160; To add a portal site connection, navigate to <strong>Site</strong> <strong>Settings</strong> &gt; <strong>Site Collection Administration</strong> &gt; <strong>Portal site connection</strong>, and specify a URL and a friendly name for the link:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image1.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb1.png" width="568" height="299" /></a> </p>
<p>Now, the breadcrumb will show a link to the root site collection:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image2.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb2.png" width="443" height="181" /></a> </p>
</p>
</p>
<p>Great! …as long as you’re always going to access your sites from a single URL.&#160; What if you have multiple URLs set up, such as the situation if you allow external access to your environment and have a separate external URL (<em>http://<strong>extranet</strong>.devexpertise.com</em>).&#160; The logical thing would be to just specify a relative link for the portal web address, however SharePoint won’t let you, and pops up a nice “Please enter a URL for the portal site” error:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image3.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb3.png" width="663" height="277" /></a> </p>
<p>Why is this really a problem?&#160; Well, let’s say you left it as <em>http://intranet.devexpertise.com</em>, and accessed it from <em>http://extranet.devexpertise.com.&#160; </em>The portal site connection link would still point to the intranet!</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image4.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb4.png" width="480" height="240" /></a> </p>
<p>Lovely, huh? Fortunately, you are able to easily set this to a relative link using a few lines of code:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre class="code"><span style="color: blue">using </span>(<span style="color: #2b91af">SPSite </span>siteCollection = <span style="color: blue">new </span><span style="color: #2b91af">SPSite</span>(<span style="color: #a31515">&quot;http://intranet.devexpertise.com/sites/accounting&quot;</span>))
{
    siteCollection.PortalUrl = <span style="color: #a31515">&quot;/&quot;</span>;
}</pre>
</div>
<p>
  <br />That’s it!&#160; Now, no matter what URL you access the accounting site from, the portal site connection link will jump you back to the correct root site collection:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/05/image5.png"  rel="lightbox"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/05/image-thumb5.png" width="465" height="240" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/05/05/sharepoint-tiptrick-specifying-a-relative-portal-site-connection-link/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Integrating a Custom ASP.NET Application into SharePoint (Part 3)</title>
		<link>http://www.devexpertise.com/2009/03/04/integrating-a-custom-aspnet-application-into-sharepoint-part-3/</link>
		<comments>http://www.devexpertise.com/2009/03/04/integrating-a-custom-aspnet-application-into-sharepoint-part-3/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 01:58:16 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint UI]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/2009/03/04/integrating-a-custom-aspnet-application-into-sharepoint-part-3/</guid>
		<description><![CDATA[In my last two posts here and here I began describing how to integrate a custom ASP.NET application into SharePoint.&#160; The first post focused on the essentials, and detailed how to get your application into the SharePoint LAYOUTS folder structure, specifically where to place your files and how to inherit SharePoint’s look and feel by [...]]]></description>
			<content:encoded><![CDATA[<p>In my last two posts <a href="http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-part-1/" >here</a> and <a href="http://www.devexpertise.com/2009/02/25/integrating-a-custom-aspnet-application-into-sharepoint-part-2/" >here</a> I began describing how to integrate a custom ASP.NET application into SharePoint.&#160; The first post focused on the essentials, and detailed how to get your application into the SharePoint LAYOUTS folder structure, specifically where to place your files and how to inherit SharePoint’s look and feel by using its master page.&#160; The second post focused on configuring permissions for your application and also demonstrated a few handy built-in controls that you can leverage to give your application that true SharePoint-like integrated look and feel.</p>
<p>This post will explain how to add custom navigation for your application.&#160; There are a few different approaches that I like to take depending on the application, and I’ll demonstrate a couple of them for you.&#160; These can be used in any combination in order to achieve the navigation you’re aiming for.&#160; In fact, I <em>recommend</em> a combination of these to achieve a fully integrated navigation structure.</p>
<p><strong>Approach #1: Quick Launch Navigation      <br /></strong>Now, modifying the Quick Launch navigation menu is a trivial task.&#160; Simply go to Site Actions &gt; Site Settings and find the settings to modify the navigation (Quick Launch on team sites, and Navigation on publishing sites), and add and remove nodes to your heart’s content.&#160; While this manual method works just fine, it’s just that: manual.&#160; I always have the mindset of if I’m already deploying an application somewhere, I might as well automate as much of the setup steps as I can.&#160; Luckily through the use of features we are able to accomplish this easily.</p>
<p>For the sake of brevity, I am going to assume you know what a SharePoint feature is, what a solution package is, and how to create and deploy them.&#160; If not, there are plenty of great resources out there that will help you out.&#160; Anyways, the first step is to create the feature and associated feature receiver that will execute when the feature is activated on the site.&#160; The feature receiver is going to utilized the SharePoint Object Model to create navigation items.</p>
<p>The first step is to create the feature receiver, which must inherit from the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfeaturereceiver.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">SPFeatureReceiver</a> class and must implement the standard 4 feature operations: FeatureActivated, FeatureDeactivated, FeatureInstalled, and FeatureUninstalled.&#160; For this post I’m only adding the items in the FeatureActivated event, but it’s probably a good idea to clean these up in the FeatureDeactivated event in case the feature is ever deactivated.&#160; My feature receiver looks like this:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">namespace </span>DevExpertise.LayoutsApp {
    <span style="color: blue">public class </span><span style="color: #2b91af">FeatureReceiver</span>: <span style="color: #2b91af">SPFeatureReceiver </span>{
        <span style="color: blue">public override void </span>FeatureActivated(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties) {
            <span style="color: blue">using </span>(<span style="color: #2b91af">SPWeb </span>site = (properties.Feature.Parent <span style="color: blue">as </span><span style="color: #2b91af">SPWeb</span>)) {
                <span style="color: green">// create the nodes
                </span><span style="color: #2b91af">SPNavigationNode </span>widgetManagementNode = <span style="color: blue">new </span><span style="color: #2b91af">SPNavigationNode</span>(<span style="color: #a31515">&quot;Widget Management&quot;</span>,
                    <span style="color: #2b91af">SPUrlUtility</span>.CombineUrl(site.Url, <span style="color: #a31515">&quot;DevExpertise.LayoutsApp/WidgetMgmt.aspx&quot;</span>), <span style="color: blue">true</span>);
                <span style="color: #2b91af">SPNavigationNode </span>viewWidgetsNode = <span style="color: blue">new </span><span style="color: #2b91af">SPNavigationNode</span>(<span style="color: #a31515">&quot;View Widgets&quot;</span>,
                    <span style="color: #2b91af">SPUrlUtility</span>.CombineUrl(site.Url, <span style="color: #a31515">&quot;DevExpertise.LayoutsApp/WidgetList.aspx&quot;</span>), <span style="color: blue">true</span>);
                <span style="color: #2b91af">SPNavigationNode </span>addWidgetNode = <span style="color: blue">new </span><span style="color: #2b91af">SPNavigationNode</span>(<span style="color: #a31515">&quot;Add Widget&quot;</span>,
                    <span style="color: #2b91af">SPUrlUtility</span>.CombineUrl(site.Url, <span style="color: #a31515">&quot;DevExpertise.LayoutsApp/AddWidget.aspx&quot;</span>), <span style="color: blue">true</span>);
                <span style="color: #2b91af">SPNavigationNode </span>widgetSettingsNode = <span style="color: blue">new </span><span style="color: #2b91af">SPNavigationNode</span>(<span style="color: #a31515">&quot;Modify Widget Settings&quot;</span>,
                    <span style="color: #2b91af">SPUrlUtility</span>.CombineUrl(site.Url, <span style="color: #a31515">&quot;DevExpertise.LayoutsApp/WidgetSettings.aspx&quot;</span>), <span style="color: blue">true</span>);

                <span style="color: green">// add the Widget management node to the menu (must be done first)
                </span>site.Navigation.QuickLaunch.AddAsLast(widgetManagementNode);

                <span style="color: green">// add the sub-items to the Widget Management node
                </span>widgetManagementNode.Children.AddAsLast(viewWidgetsNode);
                widgetManagementNode.Children.AddAsLast(addWidgetNode);
                widgetManagementNode.Children.AddAsLast(widgetSettingsNode);

                <span style="color: green">// update the site
                </span>site.Update();
            }
        }

        <span style="color: blue">public override void </span>FeatureDeactivating(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties) {
            <span style="color: green">// do nothing
        </span>}

        <span style="color: blue">public override void </span>FeatureInstalled(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties) {
            <span style="color: green">// do nothing
        </span>}

        <span style="color: blue">public override void </span>FeatureUninstalling(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties) {
            <span style="color: green">// do nothing
        </span>}
    }
}</pre>
</div>
<p>
  <br />As you can see, it’s not complicated at all.&#160; Simply add as many <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.navigation.spnavigationnode.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">SPNavigationNodes</a> as you like!&#160; The next step is to tell the feature to execute the custom feature receiver.&#160; For that just add the ReceiverAssembly and ReceiverClass elements to your feature definition file:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Feature
  </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">5856617E-BED2-4705-B030-735F7483225E</span>&quot;
  <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise Layouts Application</span>&quot;
  <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">Contains the necessary components for the DevExpertise custom LAYOUTS application.</span>&quot;
  <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;
  <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Web</span>&quot;
  <span style="color: red">Hidden</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;
  <span style="color: red">ImageUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise\devexpertiseLogo.png</span>&quot;
  <span style="color: red">ReceiverAssembly</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise.LayoutsApp, Version=1.0.0.0, culture=neutral, PublicKeyToken=d39eedb6cff9b1c8</span>&quot;
  <span style="color: red">ReceiverClass</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise.LayoutsApp.FeatureReceiver</span>&quot;
  <span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Feature</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />Once the feature is properly installed, it will show up under Site Features (note that this is scoped at the site level, and will need to be activated on each site):</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/03/image.png"  rel="lightbox"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="66" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/03/image-thumb.png" width="719" border="0" /></a> </p>
<p>
  <br />Cross your fingers, activate it, and you should the new navigation items:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/03/image1.png"  rel="lightbox"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="347" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/03/image-thumb1.png" width="143" border="0" /></a></p>
<p>
  <br />Not too shabby for a few lines of code, huh?&#160; You’re just as able to add items to the top navigation if you so desire too.&#160; </p>
<p>
  <br /><strong>Approach #2: Custom Actions<br />
    <br /></strong>One of my favorite things about SharePoint is the ability to extend just about anything, making it a true application development.&#160; Menu items are no exception, and they’re painfully simple to implement.&#160; You are able to add a custom link to the Site Actions menu, Site Settings menus, list menus, individual item menus, Central Administration menus, etc.&#160; If SharePoint has a menu somewhere, chances are you’re able to add your own item to it.&#160; There are 2 ways to do this and I’ll only be demonstrating it one way.&#160; In a future blog post I’ll show how to do all this stuff programmatically for an even more robust navigation structure.</p>
<p>For this sample Widgets application, I would like to take the navigation a bit further and add an item to the Site Actions menu and also create a group in Site Settings that will allow me to manage my application.&#160; To accomplish this, I added a new element manifest to my feature called CustomActions.xml, which will define our custom actions.&#160; Per MSDN, custom action files are included as part of a feature and deployed as XML element descriptions, and structured with a <a href="http://msdn.microsoft.com/en-us/library/ms460194.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">CustomAction</a> element, which serves as the core definition for a single action of a link or toolbar item. The following is my CustomActions.xml file, which defines a single action for the Site Actions menu:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">CustomAction
    </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">ManageWidgetAction</span>&quot;
    <span style="color: red">GroupId</span><span style="color: blue">=</span>&quot;<span style="color: blue">SiteActions</span>&quot;
    <span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.StandardMenu</span>&quot;
    <span style="color: red">Sequence</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot;
    <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Manage Widgets</span>&quot;
    <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">Manage your company's widget catalog.</span>&quot;
    <span style="color: red">ImageUrl </span><span style="color: blue">=</span>&quot;<span style="color: blue">/_layouts/images/actionssettings.gif</span>&quot;
    <span style="color: red">Rights</span><span style="color: blue">=</span>&quot;<span style="color: blue">ManageWeb,ManageLists</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">UrlAction </span><span style="color: red">Url</span><span style="color: blue">=</span>&quot;<span style="color: blue">~site/_layouts/DevExpertise.LayoutsApp/ManageWidgets.aspx</span>&quot; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">CustomAction</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">Elements</span><span style="color: blue">&gt;
</span></pre>
</div>
<p>
  <br />Let’s break this down a little bit:</p>
<ul>
<li><strong>Id</strong>.&#160; The ID of your custom action. </li>
<li><strong>GroupId</strong>. A pre-defined or custom that determines what group it will be placed into.&#160; A comprehensive list of built-in values can be found <a href="http://msdn.microsoft.com/en-us/library/bb802730.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">here</a>. </li>
<li><strong>Location</strong>.&#160; The location at which your custom action will be applied.&#160; A comprehensive list of built-in values can be found <a href="http://msdn.microsoft.com/en-us/library/bb802730.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">here</a>. </li>
<li><strong>Sequence</strong>.&#160; The order in which your custom action will appear in relation to other custom actions. </li>
<li><strong>Title</strong>.&#160; The display title of the action. </li>
<li><strong>Description</strong>.&#160; The description of the action, if applicable. </li>
<li><strong>ImageUrl</strong>. The image that is displayed next to the action, if applicable. </li>
<li><strong>Rights</strong>.&#160; A comma delimited list of <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">SPBasePermission</a> enumeration items.&#160; A comprehensive list of values can be found <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');">here</a>. </li>
<li><strong>RequireSiteAdministrator</strong>.&#160; A true/false value indicating if this option is only visible to the site collection administrator. </li>
<li>UrlAction: This element defines where the link will take you.&#160; Be sure to specify either the ~site or ~sitecollection token which tells SharePoint to build the URL relative to either the site or site collection, respectively. </li>
</ul>
<p>Simply modify the feature to include this element manifest, redeploy it, reactivate it, and you should see the following in your Site Actions menu:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/03/image2.png"  rel="lightbox"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="200" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/03/image-thumb2.png" width="253" border="0" /></a></p>
<p>
  <br />Easy, huh?&#160; Let’s take this a step further and add a few items to the Site Setting page.&#160; You can either add items to existing groups on that page, or create your own.&#160; I created my own by specifying CustomActionGroup in my CustomActions.xml file, as well as a few CustomAction elements that will be a part of my custom group.&#160; The XML is fairly straightforward:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">CustomActionGroup
  </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">LayoutsAppCustomActionGroup</span>&quot;
  <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Widget Application Settings</span>&quot;
  <span style="color: red">Sequence</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot;
  <span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.SiteSettings</span>&quot;<span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">CustomActionGroup</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">CustomAction
  </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">UserGroupAdminLinkForSettings</span>&quot;
  <span style="color: red">GroupId</span><span style="color: blue">=</span>&quot;<span style="color: blue">LayoutsAppCustomActionGroup</span>&quot;
  <span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.SiteSettings</span>&quot;
  <span style="color: red">Rights</span><span style="color: blue">=</span>&quot;<span style="color: blue">ManageWeb,ManageLists</span>&quot;
  <span style="color: red">Sequence</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot;
  <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Manage Widget Categories</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">UrlAction </span><span style="color: red">Url</span><span style="color: blue">=</span>&quot;<span style="color: blue">~site/_layouts/DevExpertise.LayoutsApp/Categories.aspx</span>&quot; <span style="color: blue">/&gt;
&lt;/</span><span style="color: #a31515">CustomAction</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">CustomAction
  </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">UserGroupAdminLinkForSettings</span>&quot;
  <span style="color: red">GroupId</span><span style="color: blue">=</span>&quot;<span style="color: blue">LayoutsAppCustomActionGroup</span>&quot;
  <span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.SiteSettings</span>&quot;
  <span style="color: red">RequireSiteAdministrator</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot;
  <span style="color: red">Sequence</span><span style="color: blue">=</span>&quot;<span style="color: blue">2</span>&quot;
  <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Modify Widget Permissions</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">UrlAction </span><span style="color: red">Url</span><span style="color: blue">=</span>&quot;<span style="color: blue">~site/_layouts/DevExpertise.LayoutsApp/Permissions.aspx</span>&quot; <span style="color: blue">/&gt;
&lt;/</span><span style="color: #a31515">CustomAction</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The only notable thing to point out here is for the CustomAction elements, the GroupId is that of the CustomActionGroup I specified first.&#160; This tells SharePoint to put these actions in the custom group.&#160; Redeploy and reactivate your feature, and you will now have this in your Site Settings page:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/03/image3.png"  rel="lightbox"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="424" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/03/image-thumb3.png" width="838" border="0" /></a> </p>
<p>
  <br />Hopefully you can see from this post that it’s pretty easy to build navigation for your custom application and have that created when your application is deployed via a custom feature.&#160; In the next and final post in this series, I will show my approach to packaging everything up into features and solution packages, and how to deploy that to SharePoint in a simple and streamlined fashion.&#160; Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/03/04/integrating-a-custom-aspnet-application-into-sharepoint-part-3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Integrating a Custom ASP.NET Application into SharePoint (Part 2)</title>
		<link>http://www.devexpertise.com/2009/02/25/integrating-a-custom-aspnet-application-into-sharepoint-part-2/</link>
		<comments>http://www.devexpertise.com/2009/02/25/integrating-a-custom-aspnet-application-into-sharepoint-part-2/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 03:18:55 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint UI]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/2009/02/25/integrating-a-custom-aspnet-application-into-sharepoint-part-2/</guid>
		<description><![CDATA[In my last post, I began describing how to integrate a custom ASP.NET application into SharePoint.&#160; SharePoint is a fantastic platform for building applications, and being able to create your own pages and application structure is a huge win when you need to add missing functionality, or to integrate a non-SharePoint application into SharePoint. 
My [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, I began describing how to integrate a custom ASP.NET application into SharePoint.&#160; SharePoint is a fantastic platform for building applications, and being able to create your own pages and application structure is a huge win when you need to add missing functionality, or to integrate a non-SharePoint application into SharePoint. </p>
<p>My previous post covered the basics – where to place your custom artifacts, how to inherit the master page and navigation, and how the custom application runs in the context specified in the URL.&#160; This post will briefly cover securing your application pages and will also cover some useful design and UI techniques to give your application a truly integrated look and feel.</p>
<p>If you took at a look at the code I provided, you may have noticed that my custom base class that sets the master page is inheriting from LayoutsPageBase.&#160; This is a page in the object model that is specifically meant to be inherited, and provides us the means to check the users’ rights.&#160; Since <a href="http://community.bamboosolutions.com/members/Nat/default.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/community.bamboosolutions.com');" target="_blank">Natnael Gebremariam</a> of Bamboo Solutions already did a fantastic job of explaining this and some of the nuances <a href="http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/10/15/secure-a-sharepoint-application-page.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/community.bamboosolutions.com');" target="_blank">in his post here</a>, I will skip that and just provide a high-level overview.&#160; Basically there are 3 properties that can be overridden to customize the required permissions for your page:</p>
<ul>
<li><strong>AllowAnonymousAccess</strong>: A boolean value indicating if the page is accessible by anonymous users. </li>
<li><strong>RequireSiteAdministrator</strong>: A boolean value indicating if the page is <em>only </em>accessible by site collection administrators. </li>
<li><strong>RightsRequired</strong>: A list of <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">SPBasePermissions</a> that specify the granular permissions that are necessary to access the page. </li>
</ul>
<p>For the purposes of this blog series I kept it simple, and I’m denying anonymous access, not requiring users to be site collection administrators, but requiring the user to have at least ManageLists and ManageWeb permissions:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">protected override bool </span>AllowAnonymousAccess {
    <span style="color: blue">get </span>{
        <span style="color: blue">return false</span>;
    }
}

<span style="color: blue">protected override bool </span>RequireSiteAdministrator {
    <span style="color: blue">get </span>{
        <span style="color: green">// only allow site collection administrators access?
        </span><span style="color: blue">return false</span>;
    }
}

<span style="color: blue">protected override </span><span style="color: #2b91af">SPBasePermissions </span>RightsRequired {
    <span style="color: blue">get </span>{
        <span style="color: #2b91af">SPBasePermissions </span>permissions = <span style="color: blue">base</span>.RightsRequired
            | <span style="color: #2b91af">SPBasePermissions</span>.ManageLists
            | <span style="color: #2b91af">SPBasePermissions</span>.ManageWeb;

        <span style="color: blue">return </span>permissions;
    }
}</pre>
</div>
<p>What I don’t particularly like is only being able to specify the permissions that are available through SharePoint, and not being able to specify my own. What if I wanted to check against Active Directory, or the users’ presence in a group, or validate against a line-of-business application?&#160; It’s not built-in, but Natnael describes a pretty good approach that will allow you to accomplish this.</p>
<p>Alright, now that I have the security in place, I can begin building the application.&#160; I’m going to pretend this application is a front-end to a line-of-business database that manages my Widget inventory.&#160; The focus of the rest of this post is going to be on utilizing some out-of-the-box SharePoint web controls.&#160; Don’t pay <em>too</em> much attention to the implementation of these, as this will serve as an overview of some of the server and user controls that you can leverage.&#160; In future posts I’ll elaborate a little on some of these and provide the nitty-gritty details, but for the sake of brevity I’ll just be covering the basics here.</p>
<p>First, we need to register the controls that we are going to use at the top of the ASPX pages.&#160; This is not a comprehensive list, but should give you the idea:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="background: #ffee62">&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;wssuc&quot; </span><span style="color: red">TagName</span><span style="color: blue">=&quot;InputFormSection&quot; </span><span style="color: red">Src</span><span style="color: blue">=&quot;/_controltemplates/InputFormSection.ascx&quot; </span><span style="background: #ffee62">%&gt;
&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;wssuc&quot; </span><span style="color: red">TagName</span><span style="color: blue">=&quot;InputFormControl&quot; </span><span style="color: red">Src</span><span style="color: blue">=&quot;/_controltemplates/InputFormControl.ascx&quot; </span><span style="background: #ffee62">%&gt;
&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;wssuc&quot; </span><span style="color: red">TagName</span><span style="color: blue">=&quot;ButtonSection&quot; </span><span style="color: red">Src</span><span style="color: blue">=&quot;/_controltemplates/ButtonSection.ascx&quot; </span><span style="background: #ffee62">%&gt;
&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;wssuc&quot; </span><span style="color: red">TagName</span><span style="color: blue">=&quot;ToolBar&quot; </span><span style="color: red">Src</span><span style="color: blue">=&quot;/_controltemplates/ToolBar.ascx&quot; </span><span style="background: #ffee62">%&gt;
&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;wssuc&quot; </span><span style="color: red">TagName</span><span style="color: blue">=&quot;ToolBarButton&quot; </span><span style="color: red">Src</span><span style="color: blue">=&quot;/_controltemplates/ToolBarButton.ascx&quot; </span><span style="background: #ffee62">%&gt;
&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Register </span><span style="color: red">TagPrefix</span><span style="color: blue">=&quot;SharePoint&quot; </span><span style="color: red">Namespace</span><span style="color: blue">=&quot;Microsoft.SharePoint.WebControls&quot;
    </span><span style="color: red">Assembly</span><span style="color: blue">=&quot;Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; </span><span style="background: #ffee62">%&gt;</span></pre>
</div>
<p>
  <br /><strong>Toolbar/SPToolBarButton<br />
    <br /></strong>Many applications have a need for a toolbar, and even SharePoint is littered with them.&#160; You’re able to build one of your own by using the Toolbar.ascx user control (inside the CONTROLTEMPLATES folder), and the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.sptoolbarbutton.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">SPToolBarButton</a> controls (found within the Microsoft.SharePoint.WebControls namespace):</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">Toolbar </span><span style="color: red">id</span><span style="color: blue">=&quot;tb&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
    &lt;</span><span style="color: #a31515">Template_Buttons</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPToolBarButton
            </span><span style="color: red">ID</span><span style="color: blue">=&quot;btnAdd&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;Add Widget&quot;
            </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;Images/add.gif&quot; </span><span style="color: red">NavigateUrl</span><span style="color: blue">=&quot;AddWidget.aspx&quot; /&gt;
        &lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPToolBarButton
            </span><span style="color: red">ID</span><span style="color: blue">=&quot;btnRefresh&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;Refresh List&quot;
            </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;Images/refresh1.ico&quot; </span><span style="color: red">OnClick</span><span style="color: blue">=&quot;btnRefresh_Click&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Template_Buttons</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Template_RightButtons</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPToolBarButton
            </span><span style="color: red">ID</span><span style="color: blue">=&quot;btnHelp&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;Help&quot;
            </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;Images/help.gif&quot; </span><span style="color: red">NavigateUrl</span><span style="color: blue">=&quot;Help.aspx&quot;  /&gt;
    &lt;/</span><span style="color: #a31515">Template_RightButtons</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">Toolbar</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The above markup will render: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image56.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="24" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb54.png" width="537" border="0" /></a>&#160; </p>
<p><strong>SPGridView<br />
    <br /></strong>The next control worth mentioning is the all-powerful <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spgridview.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">SPGridView</a> control.&#160; This control is inherited from the ASP.NET GridView control which is already a great control, but the SPGridView provides a ton more functionality.&#160; In supports grouping, it automatically inherits the styles of SharePoint, and you are able to add drop-down menus to your items, like users are already used to in lists and libraries.&#160; The markup syntax is pretty straightforward:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPGridView
    </span><span style="color: red">ID</span><span style="color: blue">=&quot;grid&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;false&quot; </span><span style="color: red">AllowSorting</span><span style="color: blue">=&quot;true&quot;
    </span><span style="color: red">AllowGrouping</span><span style="color: blue">=&quot;true&quot; </span><span style="color: red">GroupField</span><span style="color: blue">=&quot;Category&quot; </span><span style="color: red">AllowGroupCollapse</span><span style="color: blue">=&quot;true&quot;&gt;

    &lt;</span><span style="color: #a31515">Columns</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">BoundField </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;ID&quot; </span><span style="color: red">DataField</span><span style="color: blue">=&quot;ID&quot; </span><span style="color: red">SortExpression</span><span style="color: blue">=&quot;ID&quot; /&gt;
         &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">BoundField
            </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;Name&quot; </span><span style="color: red">DataField</span><span style="color: blue">=&quot;Name&quot;
            </span><span style="color: red">SortExpression</span><span style="color: blue">=&quot;Name&quot; /&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">BoundField
            </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;Price&quot; </span><span style="color: red">DataField</span><span style="color: blue">=&quot;Price&quot;
            </span><span style="color: red">SortExpression</span><span style="color: blue">=&quot;Price&quot; /&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">BoundField
            </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;Quantity on Hand&quot; </span><span style="color: red">DataField</span><span style="color: blue">=&quot;QuantityOnHand&quot;
            </span><span style="color: red">SortExpression</span><span style="color: blue">=&quot;QuantityOnHand&quot; /&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">BoundField
            </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;Date Added&quot; </span><span style="color: red">DataField</span><span style="color: blue">=&quot;DateAdded&quot;
            </span><span style="color: red">SortExpression</span><span style="color: blue">=&quot;DateAdded&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Columns</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPGridView</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The above markup will render </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image57.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="329" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb55.png" width="588" border="0" /></a> </p>
<p>Let’s take this a step further and add the familiar drop-down list to the Name column.&#160; There are a ton of examples on how to do this in code-behind, most notably <a href="http://blogs.msdn.com/powlo/default.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/blogs.msdn.com');" target="_blank">Powlo’s</a> posts <a href="http://blogs.msdn.com/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/blogs.msdn.com');" target="_blank">here</a> and <a href="http://blogs.msdn.com/powlo/archive/2007/03/23/Adding-paging-to-SPGridView-when-using-custom-data-sources.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/blogs.msdn.com');" target="_blank">here</a>, but here’s a little preview on how to do this in the markup.&#160; First, we need to create our <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.menutemplate.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">MenuTemplate</a>, which defines the items in the drop-down list:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">MenuTemplate </span><span style="color: red">ID</span><span style="color: blue">=&quot;menuTemplate&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
    &lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">MenuItemTemplate </span><span style="color: red">ID</span><span style="color: blue">=&quot;menuEdit&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
        </span><span style="color: red">Text</span><span style="color: blue">=&quot;Edit Widget&quot; </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;Images/gear.gif&quot;
        </span><span style="color: red">ClientOnClickScript</span><span style="color: blue">=&quot;javascript:editSomething('%ID%');&quot; /&gt;
    &lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">MenuItemTemplate </span><span style="color: red">ID</span><span style="color: blue">=&quot;menuDelete&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
        </span><span style="color: red">Text</span><span style="color: blue">=&quot;Delete Widget&quot; </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;Images/delete.gif&quot;
        </span><span style="color: red">ClientOnClickScript</span><span style="color: blue">=&quot;javascript:deleteSomething('%ID%');&quot; /&gt;
&lt;/</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">MenuTemplate</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />Next, replace the BoundField with an <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spmenufield.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">SPMenuField</a>, and specify the menu this is bound to by assigning the MenuTemplateID property to the ID of the menu template we just created.&#160; The TokenNameAndValueFields property assigns a token to a field in the data source.&#160; In this example, I’m declaring two tokens, one for ID and another for Name, which can then be used elsewhere.&#160; The NavigateUrlFields specifies the fields that can be used in the URL set in the NavigateUrlFormat property, and in the same order (it works like the String.Format() method):</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">SharePoint</span><span style="color: blue">:</span><span style="color: #a31515">SPMenuField
    </span><span style="color: red">HeaderText</span><span style="color: blue">=&quot;Name&quot; </span><span style="color: red">TextFields</span><span style="color: blue">=&quot;Name&quot; </span><span style="color: red">MenuTemplateId</span><span style="color: blue">=&quot;menuTemplate&quot;
    </span><span style="color: red">TokenNameAndValueFields</span><span style="color: blue">=&quot;ID=ID,NAME=Name&quot; </span><span style="color: red">NavigateUrlFields</span><span style="color: blue">=&quot;ID&quot;
    </span><span style="color: red">NavigateUrlFormat</span><span style="color: blue">=&quot;EditWidget.aspx?id={0}&quot; /&gt; </span></pre>
</div>
<p>
  <br />The above markup will render: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image58.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="244" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb56.png" width="566" border="0" /></a>&#160;</p>
<p>
  <br /><strong>Form Fields</strong> </p>
<p>For creating form fields, there are a ton of ways to skin this cat, but I typically choose one of the following two approaches.&#160; Typically your data-entry forms should either look like the forms used for new list items, or the forms for new lists, sites, or pages.&#160; The simplest and arguably cleanest approach is to just use the ASP.NET controls you’re used to, such as a TextBox, DropDownList, etc., and place them in a table that have the SharePoint styles applied to them.&#160; The end result will look something like this:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image59.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="326" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb57.png" width="594" border="0" /></a> </p>
<p>The markup is pretty simple; the important part is is the style classes applied to the elements, specifically ms-formlabel, ms-formbody, and ms-input.&#160; For the sake of brevity, here is a portion of the markup for the above form:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">tr</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">td </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-formlabel&quot;&gt;
      </span>Date Added:
  <span style="color: blue">&lt;/</span><span style="color: #a31515">td</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">td </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-formbody&quot;&gt;
      &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">TextBox </span><span style="color: red">id</span><span style="color: blue">=&quot;txtDateAdded&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">CssClass</span><span style="color: blue">=&quot;ms-input&quot; </span><span style="color: red">width</span><span style="color: blue">=&quot;200px&quot; /&gt;
  &lt;/</span><span style="color: #a31515">td</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">tr</span><span style="color: blue">&gt;
&lt;</span><span style="color: #a31515">tr</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">td </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-formlabel&quot;&gt;
      </span>Category:
  <span style="color: blue">&lt;/</span><span style="color: #a31515">td</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">td </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-formbody&quot;&gt;
      &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">DropDownList </span><span style="color: red">id</span><span style="color: blue">=&quot;txtCategory&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">CssClass</span><span style="color: blue">=&quot;ms-input&quot; </span><span style="color: red">width</span><span style="color: blue">=&quot;200px&quot;&gt;
          &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">ListItem</span><span style="color: blue">&gt;</span>Cheap Widgets<span style="color: blue">&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">ListItem</span><span style="color: blue">&gt;
          &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">ListItem</span><span style="color: blue">&gt;</span>Expensive Widgets<span style="color: blue">&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">ListItem</span><span style="color: blue">&gt;
      &lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">DropDownList</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: #a31515">td</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">tr</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The second approach is to make the form look like the new list/site pages in SharePoint.&#160; This is perfectly fine too, but takes up a little more space:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image60.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="574" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb58.png" width="594" border="0" /></a></p>
<p>The markup for this is a little more complex, and involves the use of <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.inputformsection.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">InputFormSection</a> and <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.inputformcontrol.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">InputFormControl</a> sections.&#160; A sample of the markup used for the above form is as follows:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormSection </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Title</span><span style="color: blue">=&quot;&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;dateSection&quot;&gt;
    &lt;</span><span style="color: #a31515">template_description</span><span style="color: blue">&gt;
       &lt;</span><span style="color: #a31515">b</span><span style="color: blue">&gt;</span>Date<span style="color: blue">&lt;/</span><span style="color: #a31515">b</span><span style="color: blue">&gt;&lt;</span><span style="color: #a31515">br </span><span style="color: blue">/&gt;</span>Please specify a date.
    <span style="color: blue">&lt;/</span><span style="color: #a31515">template_description</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">template_inputformcontrols</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormControl </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">LabelText</span><span style="color: blue">=&quot;Date:&quot;&gt;
            &lt;</span><span style="color: #a31515">Template_Control</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">wssawc</span><span style="color: blue">:</span><span style="color: #a31515">DateTimeControl  </span><span style="color: red">ID</span><span style="color: blue">=&quot;txtDate&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
                    </span><span style="color: red">DateOnly</span><span style="color: blue">=&quot;true&quot; /&gt;&lt;</span><span style="color: #a31515">BR </span><span style="color: blue">/&gt;
            &lt;/</span><span style="color: #a31515">Template_Control</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormControl</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">template_inputformcontrols</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormSection</span><span style="color: blue">&gt;  

&lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormSection </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Title</span><span style="color: blue">=&quot;&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;categorySection&quot;&gt;
    &lt;</span><span style="color: #a31515">template_description</span><span style="color: blue">&gt;
       &lt;</span><span style="color: #a31515">b</span><span style="color: blue">&gt;</span>Category<span style="color: blue">&lt;/</span><span style="color: #a31515">b</span><span style="color: blue">&gt;&lt;</span><span style="color: #a31515">br </span><span style="color: blue">/&gt;</span>Please specify a category
    <span style="color: blue">&lt;/</span><span style="color: #a31515">template_description</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">template_inputformcontrols</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormControl </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">LabelText</span><span style="color: blue">=&quot;Category:&quot;&gt;
            &lt;</span><span style="color: #a31515">Template_Control</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">wssawc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormTextBox </span><span style="color: red">ID</span><span style="color: blue">=&quot;txtCategory&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
                    </span><span style="color: red">Columns</span><span style="color: blue">=&quot;40&quot; </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-input&quot;  /&gt;&lt;</span><span style="color: #a31515">BR </span><span style="color: blue">/&gt;
            &lt;/</span><span style="color: #a31515">Template_Control</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormControl</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">template_inputformcontrols</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">InputFormSection</span><span style="color: blue">&gt; 

&lt;</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">ButtonSection </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ShowStandardCancelButton</span><span style="color: blue">=&quot;false&quot;&gt;
    &lt;</span><span style="color: #a31515">Template_Buttons</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Button </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-ButtonHeightWidth&quot;
            </span><span style="color: red">Text</span><span style="color: blue">=&quot;Save&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;btnSave&quot; /&gt;
        &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Button </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">class</span><span style="color: blue">=&quot;ms-ButtonHeightWidth&quot;
            </span><span style="color: red">Text</span><span style="color: blue">=&quot;Cancel&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;btnCancel&quot; </span><span style="color: red">CausesValidation</span><span style="color: blue">=&quot;false&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Template_Buttons</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">wssuc</span><span style="color: blue">:</span><span style="color: #a31515">ButtonSection</span><span style="color: blue">&gt;</span></pre>
</div>
</p>
</p>
</p>
</p>
</p>
</p>
<p>
  <br />As you can see, it’s lot more code, but you’re given a few extra things to work with, like the label and label description to the left, and the extra space to the right.&#160; You’ll also notice I’m using built-in SharePoint controls for the textboxes and the date picker.&#160; There are a bunch of controls that you can leverage, many of which I’ll cover in a future post.&#160; If you’re ambitious though, feel free to poke around the assembly with Reflector or the Object Browser in Visual Studio.&#160; Here’s a screenshot of what you’ll find:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image61.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="432" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb59.png" width="533" border="0" /></a> </p>
<p>There’s all kinds of goodies that are available for us to use in our applications.&#160; Stay tuned for a future post that will dive into a few more of them!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/25/integrating-a-custom-aspnet-application-into-sharepoint-part-2/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Integrating a Custom ASP.NET Application into SharePoint (Part 1)</title>
		<link>http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-part-1/</link>
		<comments>http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-part-1/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 00:01:45 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint UI]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-part-1/</guid>
		<description><![CDATA[One of the great things about SharePoint is in addition to all cool stuff it does out-of-the-box, you can add on functionality.&#160; More importantly though, SharePoint can be a great platform to build your own application on top of.&#160; In this series, I will show you how to build a custom ASP.NET application and integrate [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great things about SharePoint is in addition to all cool stuff it does out-of-the-box, you can add on functionality.&#160; More importantly though, SharePoint can be a great platform to build your own application on top of.&#160; In this series, I will show you how to build a custom ASP.NET application and integrate it seamlessly into SharePoint.</p>
<p>The first thing to understand is the location at which we will deploy our custom artifacts.&#160; Since the application will run under the context of a SharePoint site, the files will be deployed to the LAYOUTS folder within the ~12 directory.&#160; There isn’t a need to create a new IIS web site or virtual directory, as it’s using the SharePoint site.</p>
<p>Now, there are different opinions on where certain artifacts should go.&#160; I really don’t think it matters; just personal preference.&#160; One option is to stick with the folder structure that SharePoint uses, and just place a custom folder in each of the destinations that contain your custom artifacts.&#160; Typically this involves placing your files in the following directories: </p>
<div>
<table style="font-size: 8pt; border-collapse: collapse" width="769" border="0">
<colgroup>
<col style="width: 100px" />
<col style="width: 544px" /></colgroup>
<tbody valign="top">
<tr style="background: #dbe5f1">
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151"><span style="font-size: 8pt; font-family: verdana"><strong>Type</strong></span></td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325"><span style="font-size: 8pt; font-family: verdana"><strong>Destination</strong></span>&#160;</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291"><b>Reference Path</b>&#160;</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">.aspx</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">~/_layouts/&lt;ProjectName&gt;/Page.aspx</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">.ascx</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\CONTROLTEMPLATES\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">~/_controltemplates/&lt;ProjectName&gt;/control.ascx</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">web.config</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">.css</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\1033\Styles\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">/_layouts/1033/styles/&lt;ProjectName&gt;/style.css</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">.js</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\LAYOUTS\1033\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">/_layouts/1033/&lt;ProjectName&gt;/script.js</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">.dll</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">Either web app’s BIN directory or GAC</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">Resource DLLs</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">GAC</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">Images</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\IMAGES\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">/_layouts/images/&lt;ProjectName&gt;/image.gif</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="151">Custom Folders</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="325">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="291">~/_layouts/&lt;ProjectName&gt;/MyFolder/…</td>
</tr>
</tbody>
</table></div>
<p>&#160;</p>
<p>The other option (and my personal preference) is to put everything within a custom folder in the LAYOUTS directory, and only put those files that would require other changes in their respective places.&#160; For example, since a SafeControls entry is required in the web.config for user controls, it makes sense to keep your user controls within that folder.&#160; You could definitely put them inside the LAYOUTS folder with everything else, but then you’d have to create another SafeControls entry. </p>
<div>
<table style="font-size: 8pt; border-collapse: collapse" width="770" border="0">
<colgroup>
<col style="width: 100px" />
<col style="width: 544px" /></colgroup>
<tbody valign="top">
<tr style="background: #dbe5f1">
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147"><span style="font-size: 8pt; font-family: verdana"><strong>Type</strong></span></td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324"><span style="font-size: 8pt; font-family: verdana"><strong>Destination</strong></span>&#160;</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: #bfbfbf 0.5pt solid; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297"><b>Reference Path</b>&#160;</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147"><strong>.</strong>aspx</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">Page.aspx</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">.ascx</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\CONTROLTEMPLATES\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">~/_controltemplates/&lt;ProjectName&gt;/control.ascx</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">web.config</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">.css</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\Styles\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">Styles/style.css</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">.js</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\Scripts\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">Scripts/script.js</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">.dll</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">Either web app’s BIN directory or GAC</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">Resource DLLs</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">GAC</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">(none)</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">Images</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\Images</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">Images/image.gif</td>
</tr>
<tr>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: #bfbfbf 0.5pt solid; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="147">Custom Folders</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="324">12\TEMPLATE\LAYOUTS\&lt;ProjectName&gt;\</td>
<td style="border-right: #bfbfbf 0.5pt solid; padding-right: 10px; border-top: medium none; padding-left: 10px; padding-bottom: 3px; border-left: medium none; padding-top: 3px; border-bottom: #bfbfbf 0.5pt solid" valign="middle" width="297">MyFolder/…</td>
</tr>
</tbody>
</table></div>
<p>&#160;</p>
<p>Now that the file locations are ironed out, let’s start getting into how to develop the pages.&#160; I will dive into utilizing built-in SharePoint controls, permissions, and some of the fancier stuff in later posts, and will focus on just getting a page to show up within SharePoint.&#160; Your approach to this may differ, but this has proven very effective for me.&#160; First, I create a new web application in Visual Studio, and create a folder structure that mimics SharePoint’s 12 directory:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image52.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="362" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb50.png" width="299" border="0" /></a> </p>
<p>You’ll notice that I have 2 web.config files – one is created when the project is created and can be used to test the project locally, and the other is the one that will be put into SharePoint.&#160; My web.config that goes into SharePoint is very simple and looks like the following.&#160; For testing purposes, I added a test application setting which we’ll retrieve shortly:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: #a31515">configuration</span><span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">system.web </span><span style="color: blue">/&gt;
  &lt;</span><span style="color: #a31515">appSettings</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">add </span><span style="color: red">key</span><span style="color: blue">=</span>&quot;<span style="color: blue">customKey</span>&quot; <span style="color: red">value</span><span style="color: blue">=</span>&quot;<span style="color: blue">Sample Value</span>&quot; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: #a31515">appSettings</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">configuration</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The next part is probably the most important part of this whole process – setting up the ASPX markup correctly.&#160; Since this page will be integrated into SharePoint’s master page, the same master page/content page principles apply.&#160; The master page contains content place holders which define where page content will go, and the pages themselves define the content that gets inserted in these areas.&#160; SharePoint master pages have a ton of content place holders, most of which we don’t need in a custom application.&#160; The ones that are important are:</p>
<ul>
<li><strong>PlaceHolderAdditionalPageHead</strong>: The content area where custom scripts and styles will be referenced. </li>
<li><strong>PlaceHolderPageTitle</strong>: The title of the page. </li>
<li><strong>PlaceHolderPageTitleInTitleArea</strong>: The text that shows up right above the main content area. </li>
<li><strong>PlaceHolderMain</strong>: The main content area. </li>
<li><strong>PlaceHolderLeftNavBar</strong>: If you want to define your own QuickLaunch or left navigation, you could place it here. </li>
</ul>
<p>Since it’s up to us to define the content within these place holders, all we need to do is add content areas to our ASPX page and put in what we want.&#160; I only used the top 4 aforementioned areas, as I want to utilize the existing quick launch navigation menu:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="background: #ffee62">&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Page </span><span style="color: red">Language</span><span style="color: blue">=&quot;C#&quot; </span><span style="color: red">AutoEventWireup</span><span style="color: blue">=&quot;true&quot; </span><span style="color: red">CodeBehind</span><span style="color: blue">=&quot;Home.aspx.cs&quot;
         </span><span style="color: red">Inherits</span><span style="color: blue">=&quot;DevExpertise.LayoutsApp.Home, DevExpertise.LayoutsApp,
                   Version=1.0.0.0, Culture=neutral, PublicKeyToken=d39eedb6cff9b1c8&quot; </span><span style="background: #ffee62">%&gt;

</span><span style="color: blue">&lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content </span><span style="color: red">contentplaceholderid</span><span style="color: blue">=&quot;PlaceHolderAdditionalPageHead&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
    &lt;</span><span style="color: #a31515">link </span><span style="color: red">rel</span><span style="color: blue">=&quot;Stylesheet&quot; </span><span style="color: red">type</span><span style="color: blue">=&quot;text/css&quot; </span><span style="color: red">href</span><span style="color: blue">=&quot;Styles/style.css&quot; /&gt;
    &lt;</span><span style="color: #a31515">script </span><span style="color: red">src</span><span style="color: blue">=&quot;Scripts/script.js&quot; </span><span style="color: red">type</span><span style="color: blue">=&quot;text/javascript&quot; /&gt;
&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content </span><span style="color: red">ContentPlaceHolderID</span><span style="color: blue">=&quot;PlaceHolderPageTitle&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;Server&quot;&gt;
    </span>Page Title - Custom Application
<span style="color: blue">&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content </span><span style="color: red">ContentPlaceHolderID</span><span style="color: blue">=&quot;PlaceHolderPageTitleInTitleArea&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
    </span>Title Area - Custom Application
<span style="color: blue">&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content </span><span style="color: red">ContentPlaceHolderID</span><span style="color: blue">=&quot;PlaceHolderMain&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
    &lt;</span><span style="color: #a31515">h1</span><span style="color: blue">&gt;</span>This is a custom application!<span style="color: blue">&lt;/</span><span style="color: #a31515">h1</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">TextBox </span><span style="color: red">id</span><span style="color: blue">=&quot;txtValue&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; /&gt;
    &lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Button </span><span style="color: red">id</span><span style="color: blue">=&quot;btnSetValue&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;Click Me!&quot; </span><span style="color: red">OnClick</span><span style="color: blue">=&quot;btnSetValue_Click&quot; /&gt;
&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">Content</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />This doesn’t do much, but will prove the concept.&#160; You can see that I added a custom style sheet (style.css), and also a custom script file (script.js), just so you could see where they go.&#160; In addition, I added a textbox and a button and attached an event handler for the Click event of that button.&#160; In this event handler, I’ll retrieve the web.config setting I mentioned above and set the textbox to this value. The code-behind for this page looks like the following:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">namespace </span>DevExpertise.LayoutsApp {
    <span style="color: blue">public partial class </span><span style="color: #2b91af">Home </span>:System.Web.UI.<span style="color: #2b91af">Page  </span>{

        <span style="color: blue">protected void </span>Page_Load(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e) {
        }

        <span style="color: blue">protected void </span>btnSetValue_Click(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e) {
            txtValue.Text = <span style="color: #2b91af">WebConfigurationManager</span>.AppSettings[<span style="color: #a31515">&quot;customKey&quot;</span>].ToString();
        }
    }
}</pre>
</div>
<p>&#160; <br />Since this code will be executed under the context of SharePoint, the same code access security restrictions apply here as with web parts and custom web services.&#160; You basically have 3 options: adding the assembly to the web application’s BIN directory and setting the trust level to at least WSS_Medium in the web.config, creating a custom code access security policy for your application, or adding the assembly to the GAC.&#160; There are plenty of resources regarding the advantages and disadvantages to each approach out there so I’ll spare you here.&#160; For the sake of simplicity, I added the assembly to the GAC.</p>
<p>Next, I deployed my files to the SharePoint 12 directory.&#160; Since I’m doing this in a development/test environment, I created a handy copy.bat script that uses XCOPY to copy the files to the respective directories.&#160; As soon as this project is ready to be deployed, I’ll run my solution through WSPBuilder and will generate a deployable solution package (.WSP).</p>
<p>After the files are deployed, it’s as simple as typing in the correct URL.&#160; The syntax for this is as follows:</p>
<blockquote>
<p>http://server/site/_layouts/&lt;ProjectFolder&gt;/&lt;PageName&gt;.aspx</p>
</blockquote>
<p>The URL is extremely important when accessing your application pages, as your application <strong>runs under the context of the SharePoint site specified in the URL</strong>.&#160; What does this mean?&#160; Well, if you access your page at <em>http://server/_layouts/MyProject/MyPage.aspx</em>, then it’s running under the context of the site collection’s root site, and accessing SPContext.Current.Web will return that site.&#160; If you access your page at <em>http://server/sites/it/blog/_layouts/MyProject/MyPage.aspx</em>, then it’s running under the context of the blog site under the IT site collection, and SPContext.Current.Web will reflect that.&#160; Why is this important?&#160; Well, since the application pages live in the 12 directory on the farm, they’re globally accessible, and not limited to a single site collection or site.&#160; You could even get to your application at <em>http://CentralAdminUrl/_layouts/MyProject/MyPage.aspx</em>, and it will be running under Central Administration’s context.&#160; Now do you see the importance?&#160; I will show you in a later post how to implement safeguards to mitigate this, but be aware for now that your pages are out there for everyone to access.</p>
<p>For my development machine, I will be accessing this at the following URL:</p>
<blockquote>
<p>http://server/sites/devexpertise/_layouts/DevExpertise.LayoutsApp/Home.aspx</p>
</blockquote>
<p>However, when I try to access this, I get the following:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image53.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="474" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb51.png" width="798" border="0" /></a> </p>
<p>
  <br />No worries &#8212; all this is telling me is that we forgot to specify the master page.&#160; Since this will “inherit” the master page and styles of whichever site it’s accessed from, we must set the master page to that of the current site.&#160; To accomplish this easily for each of my application pages, I create a base LayoutsAppPage that sets the master page:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">namespace </span>DevExpertise.LayoutsApp {
    <span style="color: blue">public class </span><span style="color: #2b91af">LayoutsAppPage </span>: Microsoft.SharePoint.WebControls.<span style="color: #2b91af">LayoutsPageBase </span>{

        <span style="color: blue">protected override void </span>OnPreInit(<span style="color: #2b91af">EventArgs </span>e) {
            <span style="color: blue">base</span>.OnPreInit(e);

            <span style="color: blue">try </span>{
                <span style="color: blue">this</span>.MasterPageFile = <span style="color: #2b91af">SPContext</span>.Current.Web.MasterUrl;
            }
            <span style="color: blue">catch </span>{ }
        }
    }
}</pre>
</div>
</p>
<p>
  <br />You’ll notice that I’m inheriting this from <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.layoutspagebase.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">LayoutsPageBase</a> – this is a base class defined in the Microsoft.SharePoint.WebControls namespace that provides us functionality for creating these types of pages.&#160; That’s beyond the scope of this first post, but I will touch on this later in the series.&#160; Next, I inherit each of my application pages from my custom LayoutsAppPage base class:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 2200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">public partial class </span><span style="color: #2b91af">Home </span>: <span style="color: #2b91af">LayoutsAppPage </span>{

}</pre>
</div>
<p>
  <br />Now if we access the page in the browser, we should get a functioning page.&#160; Clicking the button should retrieve the application setting from the web.config as well:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image55.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="474" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb53.png" width="798" border="0" /></a> </p>
</p>
<p>
  <br />Pretty slick, huh?&#160; Stay tuned for the next posts in this series where we’ll look at how to secure our application and utilize existing SharePoint controls to provide a rich and familiar user interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/18/integrating-a-custom-aspnet-application-into-sharepoint-part-1/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Getting the Default SharePoint Installation Path</title>
		<link>http://www.devexpertise.com/2009/02/13/getting-the-default-sharepoint-installation-path/</link>
		<comments>http://www.devexpertise.com/2009/02/13/getting-the-default-sharepoint-installation-path/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 14:27:37 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/2009/02/13/getting-the-default-sharepoint-installation-path/</guid>
		<description><![CDATA[If you ever worked with the SharePoint Object Model and have hard-coded the path to the root files (aka “12 Hive”) directory – there’s a better way.&#160; Most of the time, the root files directory is located in the following folder:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12

But what if it’s not and your code may be [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever worked with the SharePoint Object Model and have hard-coded the path to the root files (aka “12 Hive”) directory – there’s a better way.&#160; Most of the time, the root files directory is located in the following folder:</p>
<blockquote><p>C:\Program Files\Common Files\Microsoft Shared\web server extensions\12</p>
</blockquote>
<p>But what if it’s not and your code may be used on multiple systems?&#160; It doesn’t make sense to include it in a config file, and it definitely doesn’t make sense to hard code it.&#160; Luckily the OM ships with a handy little method: SPUtility.GetGenericSetupPath().&#160; Let’s take a look…</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: #2b91af">SPUtility</span>.GetGenericSetupPath(<span style="color: blue">string</span>.Empty)</pre>
</div>
<p>Returns:</p>
<p>C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\</p>
<p>&#160;</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: #2b91af">SPUtility</span>.GetGenericSetupPath(<span style="color: #a31515">&quot;TEMPLATE&quot;</span>)</pre>
</div>
<p>Returns:</p>
<blockquote>
<p>C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\</p>
</blockquote>
<p>&#160;</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: #2b91af">SPUtility</span>.GetGenericSetupPath(<span style="color: #a31515">@&quot;TEMPLATE\1033\STS\DOCTEMP\SMARTPGS&quot;</span>)</pre>
</div>
<p>Returns:</p>
<blockquote>
<p>C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS\</p>
</blockquote>
<p>&#160;</p>
<p>If you haven’t realized it by now, all this method does is append the parameter to the root files path, meaning you <em>could</em> pass it some nonsense path and it wouldn’t care:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: #2b91af">SPUtility</span>.GetGenericSetupPath(<span style="color: #a31515">&quot;FAKEDIRECTORY&quot;</span>)</pre>
</div>
<p>Returns:</p>
<blockquote>
<p>C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\FAKEDIRECTORY\</p>
</blockquote>
<p>&#160;</p>
<p>SPUtility is a hidden gem, and contains a ton of helpful methods…take a look!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/13/getting-the-default-sharepoint-installation-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting List Items in a SharePoint List</title>
		<link>http://www.devexpertise.com/2009/02/04/deleting-list-items-in-a-sharepoint-list/</link>
		<comments>http://www.devexpertise.com/2009/02/04/deleting-list-items-in-a-sharepoint-list/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 00:28:49 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/?p=53</guid>
		<description><![CDATA[Occasionally you may encounter a need to delete list items from a SharePoint list.&#160; This sounds like an easy enough task – just loop through the SPList’s Items collection and delete the item.&#160; That would be the intuitive way, but then again this is the SharePoint Object Model.&#160; Let’s take a look a bunch of [...]]]></description>
			<content:encoded><![CDATA[<p>Occasionally you may encounter a need to delete list items from a SharePoint list.&#160; This sounds like an easy enough task – just loop through the SPList’s Items collection and delete the item.&#160; That would be the intuitive way, but then again this is the SharePoint Object Model.&#160; Let’s take a look a bunch of ways you may try to accomplish this task, and a single way which actually works.</p>
<p>To run these tests, I created a simple custom list named Widgets that contains 10 items:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image14.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="342" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb12.png" width="253" border="0" /></a>&#160;</p>
<p><strong>Incorrect Method #1      <br /></strong>The first approach that is probably taken is to loop through the list items with a For..Each loop, and call the <a href="msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.delete.aspx" target="_blank">Delete()</a> method of each list item, like the following:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">using </span>(<span style="color: #2b91af">SPSite </span>siteCollection = <span style="color: blue">new </span><span style="color: #2b91af">SPSite</span>(<span style="color: #a31515">&quot;http://server&quot;</span>)) {
    <span style="color: blue">using </span>(<span style="color: #2b91af">SPWeb </span>site = siteCollection.OpenWeb()) {
        <span style="color: #2b91af">SPList </span>list = site.Lists[<span style="color: #a31515">&quot;Widgets&quot;</span>];

        <span style="color: blue">foreach </span>(<span style="color: #2b91af">SPListItem </span>item <span style="color: blue">in </span>list.Items) {
            item.Delete();
        }
    }
}</pre>
</div>
<p>
  <br />However, whenever you run this you encounter the following error:</p>
<blockquote>
<p><strong><font color="#ff0000">Collection was modified; enumeration operation may not execute.</font></strong></p>
</blockquote>
<p>To help explain this, it will help to first understand the <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerable.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">IEnumerable</a> interface, from with the SPListItemCollection ultimately implements. Unfortunately the MSDN documentation is a little scarce on modifying collections with this interface, but the <a href="http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">IEnumerator</a> interface contains a lot of good information that applies to IEnumerable as well.&#160; </p>
<p>Basically, enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.&#160; An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection (such as deleting), the enumerator is irrecoverably invalidated.<br />
  </p>
<p><strong>Incorrect Method #2<br />
    <br /></strong>Ok, learning from the mistake in method 1, it makes sense to eliminate the For..Each loop and use a traditional For loop. This method uses an index which increments at each loop, and we call the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitemcollection.delete.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">Delete(index)</a> method of the list item which accepts an item index:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i &lt; list.Items.Count; i++) {
    <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;Deleting {0}&quot;</span>, list.Items[i].Title);
    list.Items.Delete(i);
}</pre>
</div>
<p>
  <br />To visualize the results, I’m outputting the item it’s deleting so we can see if everything is working as it should: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image15.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="139" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb13.png" width="668" border="0" /></a> </p>
<p>What the heck is happening here?&#160; Why is it deleting every <em>other</em> item?&#160; Well, every time you delete an item from the Items collection, the number of items in that collection decreases and thus the indexes no longer match up. </p>
<p></p>
<p><strong>Incorrect Method #3<br />
    <br /></strong>Hmm, OK…if it’s deleting every other item because the collection is adjusted when items are deleted from it, let’s just be safe and always try to delete the first item at index 0:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i &lt; list.Items.Count; i++) {
    <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;Deleting {0}&quot;</span>, list.Items[0].Title);
    list.Items.Delete(0);
}</pre>
</div>
<p>
  <br />The result is exactly like Method #2 – it deletes every other item:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image16.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="139" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb14.png" width="668" border="0" /></a> </p>
<p>
  <br /><strong>Incorrect Method #4<br />
    <br /></strong>For kicks and giggles, what if the code is adjusted to delete the item at index 0 inside a For..Each loop?:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">foreach </span>(<span style="color: #2b91af">SPListItem </span>item <span style="color: blue">in </span>list.Items) {
    <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;Deleting {0}&quot;</span>, list.Items[0].Title);
    list.Items.Delete(0);
}</pre>
</div>
<p>
  <br />Woah, that worked! As you can see, it deleted every item: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image17.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 5px; border-right-width: 0px" height="175" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb15.png" width="668" border="0" /></a> </p>
<p>But wait… What if we need to delete an item only if a condition is met?&#160; Let’s try to loop through the collection and only delete the item whose title is Sample Item #5:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">foreach </span>(<span style="color: #2b91af">SPListItem </span>item <span style="color: blue">in </span>list.Items) {
    <span style="color: blue">if </span>(item.Title == <span style="color: #a31515">&quot;Sample Item 5&quot;</span>) {
        <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;Deleting {0}&quot;</span>, list.Items[0].Title);
        list.Items.Delete(0);
    }
}</pre>
</div>
<p>
  <br />The result is what you should expect after deleting the first item in the index – it deletes the <em>first</em> item, not the item that met the condition:<a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image18.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="67" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb16.png" width="668" border="0" /></a> </p>
<p>
  <br /><strong>Correct Method<br />
    <br /></strong>Ok, finally here’s the correct method for deleting list items.&#160; The trick is to use a decrementing For loop.&#160; The For loop in the following example counts downward (i&#8211;) instead of upward (i++), because items are being deleted and the number of items decreases with each increment:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">for </span>(<span style="color: blue">int </span>i = list.Items.Count - 1; i &gt;= 0; i--) {
    list.Items.Delete(i);
}</pre>
</div>
<p>
  <br />Which produces: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image17.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 5px; border-right-width: 0px" height="175" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb15.png" width="668" border="0" /></a> </p>
<p>What about deleting an item based on a condition?:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">for </span>(<span style="color: blue">int </span>i = list.Items.Count - 1; i &gt;= 0; i--) {
    <span style="color: blue">if </span>(list.Items[i].Title == <span style="color: #a31515">&quot;Sample Item 5&quot;</span>) {
        <span style="color: #2b91af">Console</span>.WriteLine(<span style="color: #a31515">&quot;Deleting {0}&quot;</span>, list.Items[i].Title);
        list.Items.Delete(i);
    }
}</pre>
</div>
<p>
  <br />It works!: </p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image19.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="79" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb17.png" width="668" border="0" /></a> </p>
</p>
</p>
<p>&#160;</p>
<p>Hopefully you will always remember to delete list items (actually, the same goes for most other SharePoint collections too, such as SPFieldCollection, SPWebCollection, etc.) using a decrementing counter.&#160; Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/04/deleting-list-items-in-a-sharepoint-list/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding Custom Properties to SharePoint Features</title>
		<link>http://www.devexpertise.com/2009/02/03/adding-custom-properties-to-sharepoint-features/</link>
		<comments>http://www.devexpertise.com/2009/02/03/adding-custom-properties-to-sharepoint-features/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 23:47:25 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/?p=40</guid>
		<description><![CDATA[Any time you deploy a custom development artifact, be it a web part, assembly, etc., you should do it via a feature and SharePoint solution – especially if we’re deploying it to a client.&#160; Occasionally you need to run code when you activate or deactivate your feature by using a feature receiver.&#160; Let’s say that [...]]]></description>
			<content:encoded><![CDATA[<p>Any time you deploy a custom development artifact, be it a web part, assembly, etc., you should do it via a feature and SharePoint solution – <em>especially </em>if we’re deploying it to a client.&#160; Occasionally you need to run code when you activate or deactivate your feature by using a feature receiver.&#160; Let’s say that you need add a custom configuration property that will change between deployments.&#160; For example, one could write a generic feature that can be used for multiple projects and/or clients, and the only thing that changes is a path or value of something.&#160; Instead of placing these in a web.config file, you can place them directly in the feature.xml file that defines your feature.&#160; It’s a much better approach that mucking with the web.config, especially since you’d need to do it before activating the feature or installing the solution package.</p>
<p>Here’s an example of a feature I recently wrote for a client that ran when a new site was created.&#160; The feature receiver executes when it’s activated, and configures custom permissions for the site.&#160; I needed to add a farm administrator account to the site, but didn’t want to hard-code that into the actual code, so I put it in the feature definition:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image13.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="309" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb11.png" width="464" border="0" /></a> </p>
<p>Now, when my feature receiver code executes, I can retrieve these properties: </p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 650px; cursor: text; max-height: 400px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">public override void </span>FeatureActivated(SPFeatureReceiverProperties properties) {
    <span style="color: blue">string </span>farmAdminDomain = properties.Feature.Properties[<span style="color: #a31515">&quot;FarmAdminDomain&quot;</span>].Value;
    <span style="color: blue">string </span>farmAdminLoginName = properties.Feature.Properties[<span style="color: #a31515">&quot;FarmAdminLoginName&quot;</span>].Value;
    <span style="color: blue">string </span>farmAdmin = <span style="color: blue">string</span>.Format(<span style="color: #a31515">&quot;{0}\\{1}&quot;</span>, farmAdminDomain, farmAdminLoginName);

    <span style="color: green">// do something with values
</span></pre>
</div>
<p>&#160;</p>
<p>Features are cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/03/adding-custom-properties-to-sharepoint-features/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting the Welcome Page in WSS 3.0</title>
		<link>http://www.devexpertise.com/2009/02/02/setting-the-welcome-page-in-wss-30/</link>
		<comments>http://www.devexpertise.com/2009/02/02/setting-the-welcome-page-in-wss-30/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 00:27:31 +0000</pubDate>
		<dc:creator>DevExpert</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Object Model]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://www.devexpertise.com/?p=4</guid>
		<description><![CDATA[Whenever someone navigates to your SharePoint site without a specific page specified in the URL, such as http://fakeserver/sites/fakesite/, SharePoint navigates you to the site’s welcome page, typically default.aspx.&#160; MOSS publishing sites provide the ability to change this by going to Site Settings &#62; Welcome Page, and changing the page.&#160; What about team sites, or WSS [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever someone navigates to your SharePoint site without a specific page specified in the URL, such as http://fakeserver/sites/fakesite/, SharePoint navigates you to the site’s welcome page, typically default.aspx.&#160; MOSS publishing sites provide the ability to change this by going to Site Settings &gt; Welcome Page, and changing the page.&#160; What about team sites, or WSS sites?&#160; There is no way to modify the welcome page through the UI.&#160; One could open SharePoint Designer and do it that way, but this isn’t ideal if you don’t have a license for SPD.&#160; I’ll be describing another approach in this post that leverages the Object Model, and I’m even providing a complete SharePoint solution (WSP) file that you can install and activate on any WSS site!</p>
<p>First, let’s take a look at the code snippet to make this happen.&#160; The SPFolder object has a property called <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/msdn.microsoft.com');" target="_blank">WelcomePage</a>, and all that is needed is to set this property on the SPWeb’s RootFolder:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 1000px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">using </span>(<span style="color: #2b91af">SPSite </span>siteCollection = <span style="color: blue">new </span><span style="color: #2b91af">SPSite</span>(<span style="color: #a31515"><a href="http://server/sites/sandbox" onclick="javascript:pageTracker._trackPageview('/outbound/article/');">http://server/sites/sandbox</a></span>)) {
    <span style="color: blue">using </span>(<span style="color: #2b91af">SPWeb </span>site = siteCollection.RootWeb) {
        <span style="color: #2b91af">SPFolder </span>rootFolder = site.RootFolder;
        rootFolder.WelcomePage = <span style="color: #a31515">&quot;Pages/home.aspx&quot;</span>;
        rootFolder.Update();
    }
}</pre>
</div>
<p>
  <br />Now, whenever I hit http://server/sites/sandbox, I am directed to my custom Home.aspx page in my Pages document library:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image7.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="450" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb7.png" width="690" border="0" /></a> </p>
<p>
  <br />Woo hoo!&#160; If I click on the Sandbox title or its icon, or even in the breadcrumb, I’m directed here, because it’s to the site’s root URL, not to a specific page.&#160; But what if I click the Home link on the top navigation bar? It takes me to my original default.aspx page, which defeats the purpose.&#160; To fix this, we need to add the following lines of code:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 1000px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: #2b91af">SPNavigationNode </span>homeNode = site.Navigation.TopNavigationBar.Navigation.Home;
homeNode = site.Navigation.TopNavigationBar[0];
homeNode.Url = <span style="color: #2b91af">SPUrlUtility</span>.CombineUrl(site.Url, <span style="color: #a31515">&quot;Pages/home.aspx&quot;</span>);
homeNode.Update();</pre>
</div>
<p>
  <br />Now, no matter what I click to bring me back to the root page, I’m directed to my home.aspx page.&#160; Who said the Welcome Page was a MOSS-only feature?</p>
<p>&#160;</p>
<p><strong>SharePoint Solution</strong> </p>
<p>It doesn’t make sense to expect an end user to run a console app or write custom code to do this.&#160; It’s possible to do this via SharePoint designer too, but what if they don’t have it?&#160; It makes a lot more sense to present this to users in the browser, exactly like a MOSS publishing site.&#160; To provide this functionality, it’s just as simple as creating a custom LAYOUTS page and a solution package that can be used to deploy and install it.&#160; </p>
<p>First, we create the file-system structure in the Visual Studio solution:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image9.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="229" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb8.png" width="332" border="0" /></a> </p>
<p>
  <br />Next, define the feature:</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 1000px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: maroon">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue">?&gt;
&lt;</span><span style="color: maroon">Feature
  </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">2D3BDDCF-E6A4-4110-922C-70E79652C6B9</span>&quot;
  <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise Welcome Page Feature</span>&quot;
  <span style="color: red">Description</span><span style="color: blue">=</span>&quot;<span style="color: blue">Contains the page and shortcuts to change a site's welcome page</span>&quot;
  <span style="color: red">Version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0.0.0</span>&quot;
  <span style="color: red">Scope</span><span style="color: blue">=</span>&quot;<span style="color: blue">Site</span>&quot;
  <span style="color: red">Hidden</span><span style="color: blue">=</span>&quot;<span style="color: blue">false</span>&quot;
  <span style="color: red">ImageUrl</span><span style="color: blue">=</span>&quot;<span style="color: blue">DevExpertise.WelcomePage\devExpertiseFeatureLogo.png</span>&quot;
  <span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: maroon">ElementManifests</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">ElementManifest </span><span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">CustomActions.xml</span>&quot; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: maroon">ElementManifests</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">Feature</span><span style="color: blue">&gt;</span></pre>
</div>
<p>
  <br />The custom action should be defined to add a link to the Look &amp; Feel category (GroupId=”Customization”):</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 1000px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: maroon">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;
&lt;</span><span style="color: maroon">Elements </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/sharepoint/</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: maroon">CustomAction
    </span><span style="color: red">Id</span><span style="color: blue">=</span>&quot;<span style="color: blue">UserGroupAdminLinkForSettings</span>&quot;
    <span style="color: red">GroupId</span><span style="color: blue">=</span>&quot;<span style="color: blue">Customization</span>&quot;
    <span style="color: red">Location</span><span style="color: blue">=</span>&quot;<span style="color: blue">Microsoft.SharePoint.SiteSettings</span>&quot;
    <span style="color: red">RequireSiteAdministrator</span><span style="color: blue">=</span>&quot;<span style="color: blue">TRUE</span>&quot;
    <span style="color: red">Sequence</span><span style="color: blue">=</span>&quot;<span style="color: blue">120</span>&quot;
    <span style="color: red">Title</span><span style="color: blue">=</span>&quot;<span style="color: blue">Welcome Page</span>&quot;<span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">UrlAction </span><span style="color: red">Url</span><span style="color: blue">=</span>&quot;<span style="color: blue">_layouts/DevExpertise.WelcomePage/WelcomePage.aspx</span>&quot; <span style="color: blue">/&gt;
  &lt;/</span><span style="color: maroon">CustomAction</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">Elements</span><span style="color: blue">&gt;
</span></pre>
</div>
<p>
  <br />Package up your solution using <a href="http://www.codeplex.com/wspbuilder" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.codeplex.com');" target="_blank">WSPBuilder</a> and deploy it.&#160; After it’s deployed and activated on the site collection, I’m presented with a Welcome Page link on each and every sub site in the site collection, allowing me to set the welcome page for each site:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image10.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="224" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb9.png" width="208" border="0" /></a> </p>
<p>
  <br />Clicking the link will navigate to the custom LAYOUTS page I created:</p>
<p><a href="http://www.devexpertise.com/wp-content/uploads/2009/02/image12.png" ><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="485" alt="image" src="http://www.devexpertise.com/wp-content/uploads/2009/02/image-thumb10.png" width="709" border="0" /></a></p>
</p>
</p>
<p>
  <br />This is a great method for providing functionality that may be missing from the user interface.&#160; Once you master the steps required to create a LAYOUTS page (which I’ll be covering step-by-step in a future post), and master creating custom actions, the possibilities to extend and enhance your SharePoint site are endless.</p>
<p>I’ve included this solution package for you to deploy and use.&#160; As always, the code is as-is and without warranty, so if it doesn’t work – fix it! </p>
<p></p>
</p>
</p>
<div class="wlWriterEditableSmartContent" id="scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:8925b775-a0c2-48dd-9aaa-c6a3631ca7b3" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px">
<p>Download Solution: <a href="http://www.devexpertise.com/wp-content/uploads/2009/02/devexpertisewelcomepage3.zip" onclick="javascript:pageTracker._trackPageview('/downloads/wp-content/uploads/2009/02/devexpertisewelcomepage3.zip');" target="_blank">DevExpertise.WelcomePage.zip</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.devexpertise.com/2009/02/02/setting-the-welcome-page-in-wss-30/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
