<?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>SharePoint Fun &#187; SharePoint 2007</title>
	<atom:link href="http://blog.qumsieh.ca/tag/sharepoint-2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.qumsieh.ca</link>
	<description>Developer's blog related to ASP.NET, SharePoint and Telerik Web Controls</description>
	<lastBuildDate>Fri, 27 Jan 2012 19:08:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>DateTimeControl Saving Blank Values</title>
		<link>http://blog.qumsieh.ca/2011/04/01/datetimecontrol-saving-blank-values/</link>
		<comments>http://blog.qumsieh.ca/2011/04/01/datetimecontrol-saving-blank-values/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 21:25:36 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[DateTimeControl]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=757</guid>
		<description><![CDATA[Karine Bosch&#8217;s blog post on the SharePoint DateTimeControl is really great for understanding how to use this control in your custom web parts or application pages. It&#8217;s probably one of the only really good resources out there on this control. So to summarize, the SelectedDate property let&#8217;s us know what date the user has selected. [...]]]></description>
			<content:encoded><![CDATA[<p>Karine Bosch&#8217;s <a href="http://karinebosch.wordpress.com/sharepoint-controls/datetimecontrol-control/">blog post</a> on the SharePoint <strong>DateTimeControl</strong> is really great for understanding how to use this control in your custom web parts or application pages. It&#8217;s probably one of the only really good resources out there on this control.</p>
<p>So to summarize, the <strong>SelectedDate</strong> property let&#8217;s us know what date the user has selected. However, if the user didn&#8217;t enter a date the <strong>SelectedDate</strong> property returns <strong>Today&#8217;s</strong> date. Huh?</p>
<p>This presents a problem because of form submission. Let&#8217;s review a scenario where this causes issues:</p>
<ol>
<li>User enters a date in a DateTimeControl: April 3, 2011.</li>
<li>User submits. Date is saved as April 3, 2011 in the SharePoint DateTime field.</li>
<li>User loads form, and clears out the date in the DateTimeControl and hits submit.</li>
<li>Date is saved as April 1, 2011 (Today&#8217;s date).</li>
</ol>
<p>We don&#8217;t want it saved as Today&#8217;s date, we want it saved as blank. To get around this, we constantly have to check whether a value is entered using the <strong>IsDateEmpty</strong> property, and if so, handle the save appropriately. See my code sample below for an example of this.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">!</span>dateControl.<span style="color: #0000FF;">IsDateEmpty</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Deadline&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> dateControl.<span style="color: #0000FF;">SelectedDate</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #0600FF;">else</span>
<span style="color: #000000;">&#123;</span>
    item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Deadline&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> null<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2011/04/01/datetimecontrol-saving-blank-values/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Building a Cloneable SharePoint 2007 Environment with VMWare Fusion</title>
		<link>http://blog.qumsieh.ca/2010/11/11/building-a-cloneable-sharepoint-2007-environment-with-vmware-fusion/</link>
		<comments>http://blog.qumsieh.ca/2010/11/11/building-a-cloneable-sharepoint-2007-environment-with-vmware-fusion/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 23:30:15 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=725</guid>
		<description><![CDATA[I&#8217;ve got a backlog of articles that are in draft mode, waiting to be proof read and published, but this particular topic I wanted to take a minute and write about. There is a whole slew of information out there for the best ways to create a Cloneable SharePoint 2007 Environment. Why might you want [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a backlog of articles that are in draft mode, waiting to be proof read and published, but this particular topic I wanted to take a minute and write about.</p>
<p>There is a whole slew of information out there for the best ways to create a <strong>Cloneable SharePoint 2007 Environment</strong>. Why might you want to do that? Well for our particular case, we do a lot of training here at <a href="http://blackninjasoftware.com">Black Ninja</a>, so depending on how many students we register, we like to provide each with their own isolated SharePoint 2007 environment.</p>
<p>In the past, we&#8217;ve done this a bit too manually for my liking. So this time around, I took some time and looked into our options for creating cloneable vm&#8217;s easily and without hassle. My starting point was Michael Sivers awesome blog post titled: &#8220;<a href="http://www.mukalian.com/blog/post/2009/01/02/How-to-Create-a-Cloneable-SharePoint-Development-Environment.aspx">How to Create a Cloneable SharePoint Development Environment</a>&#8220;. I followed his instructions to a point, and because I&#8217;m running a VMWare fusion environment, I had to tweak things a little bit. I also wanted to exclude the auto farm creation and deployment because I wanted to do those steps myself.</p>
<p><strong>Software</strong> &#8211; Below is a list of software I used for my training VMs:</p>
<p>1. VMWare fusion for the mac, installed on my Mac Pro server that we use to host our VMs. This machine has 16GB of ram (soon to be 32GB) and an 8-core process.<br />
2. Microsoft Windows Server 2003 Enterprise R2 with SP2<br />
3. Microsoft SQL Server 2005 Developer Edition<br />
4. Microsoft SharePoint Server 2007<br />
5. Microsoft Visual Studio 2008 Professional<br />
6. <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=FB9D4B85-DA2A-432E-91FB-D505199C49F6">Visual Studio Extensions for WSS 1.3</a><br />
7. <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=6D94E307-67D9-41AC-B2D6-0074D6286FA9&#038;displaylang=en">Office Server SDK</a><br />
8. SharePoint Designer 2007 with SP1<br />
9. Firefox, Firebug and Web Developer extensions<br />
10. Office 2007 Ultimate<br />
11. <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=93f20bb1-97aa-4356-8b43-9584b7e72556&#038;displaylang=en">Sysprep for Win2K3 SP2</a></p>
<p><strong>Base Image</strong> &#8211; Below is a list of steps for creating the base image:</p>
<p>I used all of Michael&#8217;s steps except right before the Install <strong>Sysprep for Win2K3 SP2</strong> step, I did the following:</p>
<p>1. Install SharePoint Designer 2007 with SP1<br />
2. Install Firefox, Firebug and the Web Developer extensions<br />
3. Install Office 2007 Ultimate<br />
4. Run Windows Update<br />
5. resume with Michael&#8217;s step: <strong>Install Sysprep for Win2k3 SP2</strong></p>
<p>So what we&#8217;ve essentially just created is the base machine for all the other clone&#8217;s we&#8217;re going to create. The first step is to shut down this new VM and make a copy/backup of it. The reason we do this is because future training classes may require additional software, or patches and so you would spin up the backup, make the updates/installations and rerun <strong>Sysprep</strong> to create a new cloneable base.</p>
<p>So, Michael includes 3 files for your use that need to be configured before we run <strong>Sysprep</strong>: <strong>Sysprep.inf</strong>, <strong>startsql.bat</strong> and <strong>mossconfig.bat</strong>. In my case, I commented out the reference to <strong>mossconfig.bat</strong> in the <strong>Sysprep.inf</strong> file. I also made the changes to the <strong>startsql.bat</strong> file so that it uses the built in Administrator account.</p>
<p>Because I hadn&#8217;t used <strong>Sysprep</strong> in so long, I had no clue how to use it. In the end, I was able to find it in the <strong>deploy.cab</strong> file located in <strong>c:\Windows\system32</strong>.</p>
<p>I extracted the contents of the <strong>deploy.cab</strong> file to <strong>c:\sysprep</strong>. I copied my modified <strong>Sysprep.inf</strong> and <strong>startsql.bat</strong> files to that location. From the command line, I navigated to <strong>c:\sysprep</strong> and ran the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="script" style="font-family:monospace;">sysprep -mini -quiet -reseal shutdown</pre></div></div>

<p>Once my machine is shut down. I am ready to roll. Michael talks about <strong>Differencing</strong> .VHD files, but research seemed to indicate the VMWare Fusion equivalent was to simply copy the VM. So basically, to make clone&#8217;s of these VMs I simply copy and paste to make a copy. I rename the VM, start it up and walk through the prompts to configure the new server. Once that boots, I created a local user account: <strong>moss_farmsvc</strong> and ran the <strong>SharePoint Configuration Wizard</strong>. When prompted, I have it the <strong>moss_farmsvc</strong> account, specified the db server, and configured <strong>CA</strong> to run on port <strong>8888</strong>. Voila, I&#8217;ve got one VM ready to go. Rinse and repeat until you&#8217;ve got enough VMs for all your students!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2010/11/11/building-a-cloneable-sharepoint-2007-environment-with-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Determine Entity Type in PeopleEditor Control</title>
		<link>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/</link>
		<comments>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/#comments</comments>
		<pubDate>Fri, 05 Nov 2010 00:13:36 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[PeopleEditor]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=719</guid>
		<description><![CDATA[Because I don&#8217;t write nearly enough on this topic, I figured why not add another post about the splendid PeopleEditor control for SharePoint. Actually, these posts happen to be among my most popular. So popular in fact, that they are constantly being stolen and posted on other blogs without so much as a courtesy ping [...]]]></description>
			<content:encoded><![CDATA[<p>Because I don&#8217;t write nearly enough on this topic, I figured why not add another post about the splendid <strong>PeopleEditor</strong> control for SharePoint. Actually, these posts happen to be among my most popular. So popular in fact, that they are constantly being stolen and posted on other blogs without so much as a courtesy ping back! I won&#8217;t point any of those users out as they don&#8217;t deserve any precious link love. However, if you come across a <strong>PeopleEditor</strong> post that looks suspiciously like mine, I&#8217;m the original author!</p>
<p>Ok, so now that my rant is over, let&#8217;s go over a new trick I recently discovered when working with the <strong>PeopleEditor</strong>. Whenever I&#8217;ve worked with this control in the past, I&#8217;ve usually only dealt with <strong>SelectionSets</strong> that are limited to <strong>Users</strong>. So there has never been a need to handle entries where groups are specified. In case you are not familiar, here is a listing of the possible options for the <strong>SelectionSet</strong> property, posted by <a href="http://msdn.microsoft.com/en-us/library/community/user/155976.aspx">Alex</a> and <a href="http://msdn.microsoft.com/en-us/library/community/user/27262.aspx">Ozaki</a> on the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.peopleeditor.selectionset(office.12).aspx">MSDN PeopleEditor.SelectionSet Page</a> &#8211; Community Section: </p>
<ul>
<li>User = single user</li>
<li>DL = AD distribution list</li>
<li>SecGroup = AD security group</li>
<li>SPGroup = SharePoint group</li>
</ul>
<p>I came across this requirement recently. More specifically, I needed to be able to save both users and groups, but obviously the logic for saving those is a little different. So we need a mechanism that helps us determine what type of entity a user has provided and based on that, process the correct save method.</p>
<p>So, let&#8217;s say we have a PeopleEditor defined as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>SharePoint<span style="color: #008000;">:</span>PeopleEditor ID<span style="color: #008000;">=</span><span style="color: #666666;">&quot;peManager&quot;</span> runat<span style="color: #008000;">=</span><span style="color: #666666;">&quot;server&quot;</span> MultiSelect<span style="color: #008000;">=</span><span style="color: #666666;">&quot;false&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;200px&quot;</span> AllowEmpty<span style="color: #008000;">=</span><span style="color: #666666;">&quot;true&quot;</span> SelectionSet<span style="color: #008000;">=</span><span style="color: #666666;">&quot;User,SPGroup&quot;</span> <span style="color: #008000;">/&gt;</span></pre></div></div>

<p>Now we want to save whatever the user enters into a column of type <strong>Person or Group</strong> that can accept both users and groups.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">foreach</span> <span style="color: #000000;">&#40;</span>PickerEntity entity <span style="color: #0600FF;">in</span> peManager.<span style="color: #0000FF;">ResolvedEntities</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">switch</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span>entity.<span style="color: #0000FF;">EntityData</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;PrincipalType&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">case</span> <span style="color: #666666;">&quot;User&quot;</span><span style="color: #008000;">:</span>
            item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Assigned&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> SavePeopleEditorControl<span style="color: #000000;">&#40;</span>peManager.<span style="color: #0000FF;">CommaSeparatedAccounts</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            break<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">case</span> <span style="color: #666666;">&quot;SharePointGroup&quot;</span><span style="color: #008000;">:</span>
            SPGroup group <span style="color: #008000;">=</span> web.<span style="color: #0000FF;">Groups</span><span style="color: #000000;">&#91;</span>entity.<span style="color: #0000FF;">EntityData</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;AccountName&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Assigned&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> group<span style="color: #008000;">;</span>
            break<span style="color: #008000;">;</span>
        <span style="color: #008080; font-style: italic;">// add additional case statements for the other SelectionSets</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>There you have it. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2010/11/04/how-to-determine-entity-type-in-peopleeditor-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add Column Descriptions to Your Custom Forms</title>
		<link>http://blog.qumsieh.ca/2010/04/13/how-to-add-column-descriptions-to-your-custom-forms/</link>
		<comments>http://blog.qumsieh.ca/2010/04/13/how-to-add-column-descriptions-to-your-custom-forms/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 19:08:33 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=646</guid>
		<description><![CDATA[This is a quick overview on how to add a column&#8217;s description to your custom edit and disp forms in SharePoint 2007. List Name: Projects Column Name: Status Column Type: Lookup Column Description: &#8220;Choose the status for this current project.&#8221; To add a column to a form and display it&#8217;s contents, it&#8217;s pretty straight forward: [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick overview on how to add a column&#8217;s description to your custom edit and disp forms in SharePoint 2007.</p>
<p><strong>List Name</strong>: Projects<br />
<strong>Column Name</strong>: Status<br />
<strong>Column Type</strong>: Lookup<br />
<strong>Column Description</strong>: &#8220;Choose the status for this current project.&#8221;</p>
<p>To add a column to a form and display it&#8217;s contents, it&#8217;s pretty straight forward:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">SPWeb web <span style="color: #008000;">=</span> SPContext.<span style="color: #0000FF;">Current</span>.<span style="color: #0000FF;">Web</span><span style="color: #008000;">;</span>
SPList projects <span style="color: #008000;">=</span> web.<span style="color: #0000FF;">Lists</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Projects&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
SPListItem item <span style="color: #008000;">=</span> projects.<span style="color: #0000FF;">GetItemById</span><span style="color: #000000;">&#40;</span>Convert.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span>Request.<span style="color: #0000FF;">QueryString</span><span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;ID&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// use this to grab the value, you can get either the ID or the Value in the column</span>
SPFieldLookupValue status <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPFieldLookupValue<span style="color: #000000;">&#40;</span>Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Status&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lblStatus.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> status.<span style="color: #0000FF;">LookupValue</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">// use this to grab the columns description, or any other property for that column</span>
SPFieldLookup statusDesc <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPFieldLookup<span style="color: #000000;">&#40;</span>projects.<span style="color: #0000FF;">Fields</span>, <span style="color: #666666;">&quot;Status&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
lblStatusDesc.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">=</span> statusDesc.<span style="color: #0000FF;">Description</span><span style="color: #008000;">;</span></pre></div></div>

<p>The above works great, but please note that the column name for the <strong>SPFieldLookup</strong> method requires the SharePoint Internal Field Name. So for example, if your column name was Project Status, and you created the column with the spaces, then it will be <strong>Project_x0020_Status</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2010/04/13/how-to-add-column-descriptions-to-your-custom-forms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hide Columns in SharePoint New, Edit and Disp Forms</title>
		<link>http://blog.qumsieh.ca/2010/02/16/hide-columns-in-sharepoint-new-edit-and-disp-forms/</link>
		<comments>http://blog.qumsieh.ca/2010/02/16/hide-columns-in-sharepoint-new-edit-and-disp-forms/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:36:38 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=639</guid>
		<description><![CDATA[Hiding columns in SharePoint is nothing new really, there have been several articles written on this topic. The approach for doing this, however, does inspire some debate in terms of what the best practice is. Let&#8217;s say we can agree that there are three ways to get this done: Using the built in content types [...]]]></description>
			<content:encoded><![CDATA[<p>Hiding columns in SharePoint is nothing new really, there have been several articles written on this topic. The approach for doing this, however, does inspire some debate in terms of what the best practice is. Let&#8217;s say we can agree that there are three ways to get this done:</p>
<ol>
<li>Using the built in content types to specify which columns you wish to be hidden.</li>
<li>Using jQuery and a content editor web part to hide the columns as desired.</li>
<li>Hide the columns programmatically using code.</li>
</ol>
<p>I just wanted to make some comments on all three. The content type approach is a good one and relatively simple to implement. Once you&#8217;ve enabled content types for your list or library, click on the default content type, let&#8217;s say it&#8217;s Item, and choose the column you&#8217;d like to have hidden and simply set it&#8217;s column settings to Hidden. Here is an excellent reference for this technique: <a href="http://littletalk.wordpress.com/2009/03/30/hide-remove-title-column-from-sharepoint-list/" target="_blank">http://littletalk.wordpress.com/2009/03/30/hide-remove-title-column-from-sharepoint-list/</a>.</p>
<p>Ok so the above works good, but what happens if you only want to introduce these hidden columns on your <strong>New</strong> and <strong>Edit</strong> forms but not your <strong>Disp</strong> form as an example. Or what if your scenario requires that they are hidden from all default <strong>New</strong>, <strong>Edit</strong> and <strong>Disp</strong> forms, but you have some custom SharePoint Designer disp forms that you&#8217;ve created that those fields need to be visible on. The content type approach will hide the column for all forms and so that won&#8217;t always work. We need something more granular.</p>
<p>So there is where the jQuery approach comes in handy. Some great resources for this:</p>
<ul>
<li>Paul Galvin has written some great articles on this topic over at <a href="http://endusersharepoint.com" target="_blank">EndUserSharePoint</a> &#8211; <a href="http://www.endusersharepoint.com/2009/06/17/quick-and-easy-use-jquery-to-hide-a-text-field-on-a-sharepoint-form/" target="_blank">http://www.endusersharepoint.com/2009/06/17/quick-and-easy-use-jquery-to-hide-a-text-field-on-a-sharepoint-form/</a> and <a href="http://www.endusersharepoint.com/2009/06/18/quick-and-easy-a-better-way-to-use-jquery-to-hide-a-text-field-on-a-sharepoint-form/" target="_blank">http://www.endusersharepoint.com/2009/06/18/quick-and-easy-a-better-way-to-use-jquery-to-hide-a-text-field-on-a-sharepoint-form/</a></li>
</ul>
<p>As per the comments by Nathan Ahlstrom in the second link noted above, the final fix for me was to use:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nobr:contains(&quot;Completion time&quot;)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">closest</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'nobr:contains(&quot;Score&quot;)'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">closest</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tr'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Please note that I had to add quotes around the <strong>tr</strong> tag for this to work for me.</p>
<p>The final approach uses some custom code and the object model to hide columns for a given list. <a href="http://www.sharepointkings.com/2008/05/how-to-hide-column-of-sharepoint-list.html">http://www.sharepointkings.com/2008/05/how-to-hide-column-of-sharepoint-list.html</a>. Now I&#8217;m not entirely sure how this works with custom forms besides the <strong>New</strong>, <strong>Edit</strong> and <strong>Disp</strong> forms, and until I have time to try out, I won&#8217;t know the answer to that. It&#8217;s worth mentioning because it does give you some granularity in that you can specify hidden properties per form.</p>
<p>That&#8217;s all for now. Please send in your comments if you have them, would love to hear from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2010/02/16/hide-columns-in-sharepoint-new-edit-and-disp-forms/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Access to table dbo.Versions is blocked because the signature is not valid</title>
		<link>http://blog.qumsieh.ca/2009/09/25/access-to-table-dboversions-is-blocked-because-the-signature-is-not-valid/</link>
		<comments>http://blog.qumsieh.ca/2009/09/25/access-to-table-dboversions-is-blocked-because-the-signature-is-not-valid/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 18:31:20 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=479</guid>
		<description><![CDATA[Alright, today&#8217;s blog post is going to be a bit infrastructure related. More specifically, I&#8217;d like to document an issue we encountered recently trying to do a restore from a production server to one of our development boxes. We do this often to keep our development data fresh and in sync with production, otherwise it [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, today&#8217;s blog post is going to be a bit infrastructure related. More specifically, I&#8217;d like to document an issue we encountered recently trying to do a restore from a production server to one of our development boxes. We do this often to keep our development data fresh and in sync with production, otherwise it becomes difficult to do any sort of real testing with numbers. Usually, this is a pretty standard procedure for us:</p>
<ol>
<li>Within <strong>Central Administratio</strong>n, under <strong>Application Management</strong>, we navigate to <strong>Content databases</strong></li>
<li>Making sure to select the <strong>Web Application</strong> we plan to restore to, we click on the <strong>WSS_Content</strong> link (or whatever happens to be the name of your db)</li>
<li>Within the <strong>Manage Content Database Settings</strong> page, change the <strong>Database status</strong> drop down from Ready to Offline</li>
<li>From here I stop the IIS Web Site, restart SQL Server and kick off my restore</li>
<li>Once the restore is complete, I head back into my <strong>Manage Content Database Settings</strong> page and switch the <strong>Database status</strong> back to Ready</li>
</ol>
<p>Now usually this works without issue. But recently, while attempting to do this on a machine we hadn&#8217;t worked with on a few weeks, we were encountering all sorts of errors trying to navigate to our site collection. Specifically, we were seeing the following error in the Operations logs:</p>
<blockquote><p><span style="color: #ff0000;">The specified SPContentDatabase Name=WSS_Content Parent=SPDatabaseServiceInstance Name=Microsoft##SSEE has been upgraded to a newer version of SharePoint. Please upgrade this SharePoint application server before attempting to access this object.</span></p></blockquote>
<p>Based on this error, my first thought was to check the <strong>dbo.Versions</strong> table to see if perhaps we had a conflict in versions as this error would suggest. Unfortunately, trying to read from the <strong>dbo.Versions</strong> table resulted in this pretty error:</p>
<blockquote><p><span style="color: #ff0000;">Msg 33002, Level 16, State 1, Line 1<br />
Access to table <strong>dbo.Versions</strong> is blocked because the signature is not valid.</span></p></blockquote>
<p>So now we&#8217;re having fun at this point. I can&#8217;t read from the <strong>dbo.Versions</strong> table, so I don&#8217;t really know what the patch level of this particular server is. After checking production, I know that my patch level is <strong>12.0.0.6504</strong>. In order to cross check what this means, you should have this link handy from the <a href="http://sharepointdevwiki.com/display/SharePointAdministrationWiki/SharePoint+Versions">SharePointDevWiki</a>.</p>
<p>Based on what I was reading there, my production server had the: <strong>MOSS 2007 or WSS 3.0 April 2009 Cumulative update</strong>. I know I probably could have done the research and checked file versions, but why should I have to do that when all I really needed to do was read from <strong>dbo.Versions</strong>? After a bit of troubleshooting, I realized it would make the most sense to simply spin up a new Web Application and fresh content db on my development box and read <strong>ITS</strong> <strong>dbo.Versions</strong> table. Turns out that original error was right on the money, my development box was one version behind: <strong>12.0.0.6421</strong>.</p>
<p>Once I upgraded to the missing cumulative update and tried my restore process again, everything was back to normal! I hope that helps someone understand what the <strong>dbo.Versions</strong> table is all about, and what you can do to get past these errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/09/25/access-to-table-dboversions-is-blocked-because-the-signature-is-not-valid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Invalid Data Updating List Item &#8211; FREE TSHIRT GIVEAWAY</title>
		<link>http://blog.qumsieh.ca/2009/09/15/invalid-data-updating-list-item-free-tshirt-givewaway/</link>
		<comments>http://blog.qumsieh.ca/2009/09/15/invalid-data-updating-list-item-free-tshirt-givewaway/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 20:06:26 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Object Model]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=474</guid>
		<description><![CDATA[If you&#8217;re like me and you do a fair bit of object model programming, you&#8217;ve likely seen this error before. More specifically, the error is as follows: Unhandled Exception: Microsoft.SharePoint.SPException: Invalid data has been used to update the list item. The field you are trying to update may be read only. There are probably more [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me and you do a fair bit of object model programming, you&#8217;ve likely seen this error before. More specifically, the error is as follows:</p>
<blockquote><p><span style="color: #ff0000;">Unhandled Exception: Microsoft.SharePoint.SPException: Invalid data has been used to update the list item. The field you are trying to update may be read only.</span></p></blockquote>
<p>There are probably more than one cause for this particular issue, but in my case, it always comes down to an error in the way I&#8217;ve assigned a field of type <strong>Lookup</strong>.</p>
<p>So to set up our scenario, let&#8217;s say we have a custom list called <strong>Types</strong>, and it contains 3 items: </p>
<ol>
<li>Employee</li>
<li>Contractor</li>
<li>Manager</li>
</ol>
<p>Now let&#8217;s assume we&#8217;ve created a custom list called <strong>Users</strong> and it contains a column called <strong>User Type</strong> of type <strong>Lookup</strong> that points to the <strong>Types</strong> list using the <strong>Title</strong> column.</p>
<p>If we&#8217;re doing some updates to our list programmatically, we&#8217;ll need to be able to set the <strong>Type</strong> column. Your typical scenario is that you&#8217;re reading this from a form control and populating this field. In my case, I knew specifically what value I wanted to set. So let&#8217;s start with something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">SPListItem item <span style="color: #008000;">=</span> list.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Type&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Employee&quot;</span><span style="color: #008000;">;</span>
item.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Unfortunately, the above bit of code will fail with the error outlined at the beginning of this post. The data we&#8217;re attempting to assign is not valid. What we need to do is create another object, an <strong>SPFieldLookupValue</strong> object to be more specific, and use one of the constructors to build the lookup that we&#8217;ll then assign to our field.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">SPListItem item <span style="color: #008000;">=</span> list.<span style="color: #0000FF;">Items</span>.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
SPFieldLookupValue lookup <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> SPFieldLookupValue<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #666666;">&quot;Employee&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
item<span style="color: #000000;">&#91;</span><span style="color: #666666;">&quot;Type&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> lookup<span style="color: #008000;">;</span>
item.<span style="color: #0000FF;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>I&#8217;m not satisfied with the above, because it&#8217;s forcing me to hard code the id and the value. I am interested in some feedback from my readers &#8212; does anyone have a better approach to this problem? I&#8217;ll be awarding a free <a href="http://www.blackninjasoftware.com">Black Ninja</a> TSHIRT to the reader who can provide me the most elegant workaround.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/09/15/invalid-data-updating-list-item-free-tshirt-givewaway/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll be attending the SharePoint Conference in October!</title>
		<link>http://blog.qumsieh.ca/2009/09/14/ill-be-attending-the-sharepoint-conference-in-october/</link>
		<comments>http://blog.qumsieh.ca/2009/09/14/ill-be-attending-the-sharepoint-conference-in-october/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 23:35:49 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=471</guid>
		<description><![CDATA[I&#8217;m very excited and I consider myself quite lucky to be able to attend the Microsoft SharePoint 2009 Conference in October. I&#8217;ve already been to a couple great conferences this year, but I am quite confident this will be a good one. I&#8217;m looking forward to seeing all that 2010 has to offer. If you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.qumsieh.ca/wp-content/uploads/2009/09/spc09_3_3.jpg"><img class="alignnone size-medium wp-image-472" title="Print" src="http://blog.qumsieh.ca/wp-content/uploads/2009/09/spc09_3_3.jpg" alt="" width="117" height="66" /></a> I&#8217;m very excited and I consider myself quite lucky to be able to attend the Microsoft SharePoint 2009 Conference in October. I&#8217;ve already been to a couple great conferences this year, but I am quite confident this will be a good one. I&#8217;m looking forward to seeing all that 2010 has to offer.</p>
<p>If you haven&#8217;t already, you might want to check out the <a title="SharePoint 2010 Preview Videos" href="http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx" target="_blank">preview videos</a> over at the Microsoft SharePoint site.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/09/14/ill-be-attending-the-sharepoint-conference-in-october/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom SharePoint Workflows sendEmail.Body Character Limit</title>
		<link>http://blog.qumsieh.ca/2009/07/09/custom-sharepoint-workflows-sendemailbody-character-limit/</link>
		<comments>http://blog.qumsieh.ca/2009/07/09/custom-sharepoint-workflows-sendemailbody-character-limit/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 00:04:59 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Workflows]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=457</guid>
		<description><![CDATA[I&#8217;ve been working over the past few days with a custom workflow I&#8217;m building in Visual Studio 2005 that&#8217;s responsible for notifying users when specific criteria was met. Inside the workflow, I have a few sendEmail functions responsible for building the content within the email message: 1 2 sendEmail1.Body += &#34;&#60;font face=\&#34;Arial\&#34;&#62;This is the body [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working over the past few days with a custom workflow I&#8217;m building in Visual Studio 2005 that&#8217;s responsible for notifying users when specific criteria was met. Inside the workflow, I have a few <strong>sendEmail</strong> functions responsible for building the content within the email message:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">sendEmail1.<span style="color: #0000FF;">Body</span> <span style="color: #008000;">+=</span> <span style="color: #666666;">&quot;&lt;font face=<span style="color: #008080; font-weight: bold;">\&quot;</span>Arial<span style="color: #008080; font-weight: bold;">\&quot;</span>&gt;This is the body of my email.&lt;br/&gt;&lt;br/&gt;&quot;</span><span style="color: #008000;">;</span>
sendEmail1.<span style="color: #0000FF;">Body</span> <span style="color: #008000;">+=</span> <span style="color: #666666;">&quot;Adding some information for users that will describe some detail about this item.&lt;/font&gt;&quot;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>The above worked well until I started to see some truncating in my emails. I did some comparisons and found that the truncating would occur when the character count exceeded 2048 characters. I figured this couldn&#8217;t be the limit for a string in .NET so I did a bit of digging around and finally discovered that the root of the issue was because I didn&#8217;t have any line breaks in my string: <strong>&#8220;\r\n&#8221;</strong>. Once I inserted those at specific intervals, the truncating disappeared.</p>
<p>Awesome! Hope this helps someone else out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/07/09/custom-sharepoint-workflows-sendemailbody-character-limit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Programmatically Trigger a Custom Workflow</title>
		<link>http://blog.qumsieh.ca/2009/07/08/how-to-programmatically-trigger-a-custom-workflow/</link>
		<comments>http://blog.qumsieh.ca/2009/07/08/how-to-programmatically-trigger-a-custom-workflow/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 18:24:51 +0000</pubDate>
		<dc:creator>shereen</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Workflows]]></category>

		<guid isPermaLink="false">http://blog.qumsieh.ca/?p=450</guid>
		<description><![CDATA[Triggering SharePoint workflows programmatically from within a custom built Visual Studio workflow is not difficult once you know where to look. Tony Testa wrote a great post on this very same thing that describes these concepts in more detail than I will &#8212; so go check that out if you haven&#8217;t already. I had to [...]]]></description>
			<content:encoded><![CDATA[<p>Triggering SharePoint workflows programmatically from within a custom built Visual Studio workflow is not difficult once you know where to look. Tony Testa wrote a <a href="http://www.tonytestasworld.com/post/Howto-Start-a-Sharepoint-Workflow-Programmatically.aspx">great post</a> on this very same thing that describes these concepts in more detail than I will &#8212; so go check that out if you haven&#8217;t already. I had to tweak his concept a little bit because I was doing this within an already running workflow that belonged to a content type not a list. </p>
<p>So in my scenario, I had a single workflow tied to a Content Type, and because I knew there was only one workflow, I used index at 0 to get the current workflow association. If your workflow is tied to a list, then you may not need to call <strong>ContentType</strong>, you might be able to use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">SPWorkflowAssociation workflowAssociation <span style="color: #008000;">=</span> workflowProperties.<span style="color: #0000FF;">List</span>.<span style="color: #0000FF;">WorkflowAssocations</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>If you have multiple workflows tied to a Content Type or a List, you will need to grab the Guid associationId for that workflow instead of using the index.</p>
<p>Finally, once I have my workflow association configured, I can start my workflow by passing it the parameters it needs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>workflowProperties.<span style="color: #0000FF;">Site</span>.<span style="color: #0000FF;">WorkflowManager</span>.<span style="color: #0000FF;">GetItemActiveWorkflows</span><span style="color: #000000;">&#40;</span>setLeaderItem<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Count</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    SPWorkflowAssociation workflowAssociation <span style="color: #008000;">=</span> workflowProperties.<span style="color: #0000FF;">Item</span>.<span style="color: #0000FF;">ContentType</span>.<span style="color: #0000FF;">WorkflowAssociations</span><span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
    workflowProperties.<span style="color: #0000FF;">Site</span>.<span style="color: #0000FF;">WorkflowManager</span>.<span style="color: #0000FF;">StartWorkflow</span><span style="color: #000000;">&#40;</span>setLeaderItem, workflowAssociation, workflowAssociation.<span style="color: #0000FF;">AssociationData</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The IF block is there to check if any active workflow are running on that list item. If there aren&#8217;t, it attempts to start the workflow. There you have it! That should trigger the workflow on the list item you specified.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.qumsieh.ca/2009/07/08/how-to-programmatically-trigger-a-custom-workflow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

