<?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>Kit Menke&#039;s Blog &#187; MOSS2007</title>
	<atom:link href="http://kitmenke.com/blog/tag/moss2007/feed/" rel="self" type="application/rss+xml" />
	<link>http://kitmenke.com/blog</link>
	<description>Experiences with SharePoint, web development, and programming</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:28:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Customizing EditForm.aspx in a Publishing site</title>
		<link>http://kitmenke.com/blog/2010/12/11/customizing-editform-aspx-in-a-publishing-site/</link>
		<comments>http://kitmenke.com/blog/2010/12/11/customizing-editform-aspx-in-a-publishing-site/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 04:56:56 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[MOSS2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=318</guid>
		<description><![CDATA[After recently doing a lot of work heavily customizing NewForm.aspx and EditForm.aspx for a SharePoint list, I ran into a major issue after I moved my list into a publishing site. The issue appeared when I added a webpart onto my EditForm. As soon as another webpart was added, the entire page switched into some sort [...]]]></description>
			<content:encoded><![CDATA[<p>After recently doing a lot of work heavily customizing NewForm.aspx and EditForm.aspx for a SharePoint list, I ran into a major issue after I moved my list into a publishing site. The issue appeared when I added a webpart onto my EditForm.</p>
<p><span id="more-318"></span></p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/normal-view.png"><img class="alignnone size-medium wp-image-321" title="normal view" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/normal-view-300x105.png" alt="" width="300" height="105" /></a><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/normal-view.png"></a></p>
<p>As soon as another webpart was added, the entire page switched into some sort of weird publishing mode.</p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/publishing-view.png"><img class="alignnone size-medium wp-image-323" title="publishing view" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/publishing-view-300x129.png" alt="" width="300" height="129" /></a><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/publishing-view.png"></a></p>
<p>This new mode has a couple of changes to the form:</p>
<ol>
<li>A publishing toolbar now appears at the top</li>
<li>Every field in the List View Web Part has an additional &#8220;form&#8221; label</li>
<li>Additional JavaScript is added to the page that prompts the user to save whenever an attempts to navigate somewhere differently: To save your changes before continuing, click &#8220;OK&#8221;. To continue without saving changes, click &#8220;Cancel&#8221;.</li>
</ol>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/publishing-view-red.png"><img class="alignnone size-medium wp-image-322" title="publishing view red" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/publishing-view-red-300x129.png" alt="" width="300" height="129" /></a></p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/javascript-dialog.png"><img title="javascript dialog" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/javascript-dialog-300x66.png" alt="" width="300" height="66" /></a></p>
<p>In my case, this new mode definitely would not work for what I was trying to do. The labels increase the size of the form dramatically, the publishing toolbar makes it seem as if you are editing the page rather than a list item, and this new mode does NOT appear on NewForm.aspx which means the forms are dramatically inconsistent.</p>
<p>After googling, I found a couple of people who have had <a href="http://social.msdn.microsoft.com/Forums/en/sharepointcustomization/thread/e10ad027-c28a-43ab-8b48-bb02dc3ca782">similar</a> <a href="http://social.msdn.microsoft.com/Forums/en-CA/sharepointcustomization/thread/f00d37d3-2254-44fa-8f4d-ae7683c645cf">issues</a>. The root cause seems to be the Office SharePoint Server Publishing site feature. Since disabling the feature on the site was not an option, I had to find another way. JavaScript and CSS was a viable option (since I&#8217;m customizing the form using these anyway) but I felt like I needed a more bullet proof method.</p>
<p>My method involves using SharePoint Designer to customize EditForm.aspx. (<strong><span style="color: #ff6600;">Updated January 13th, 2011</span> after ADE&#8217;s comment below. Thanks a lot!) </strong></p>
<p><strong>Step 1: </strong>Create a new custom EditForm.aspx by right clicking on EditForm.aspx, click &#8220;New From Existing Page&#8221;</p>
<p><strong> </strong></p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/new-from-existing-page.png"><img class="alignnone size-medium wp-image-330" title="new from existing page" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/new-from-existing-page-300x196.png" alt="" width="300" height="196" /></a><strong> </strong></p>
<p><strong>Step 2:</strong> Add the SPNavigation line in right before PlaceHolder Main:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;asp:Content</span> <span style="color: #000066;">ContentPlaceHolderId</span>=<span style="color: #ff0000;">&quot;PlaceHolderLeftNavBar&quot;</span> <span style="color: #000066;">runat</span>=<span style="color: #ff0000;">&quot;server&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="display:block;background-color:#ffff66"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;asp:Content</span> <span style="color: #000066;">ContentPlaceHolderId</span>=<span style="color: #ff0000;">&quot;SPNavigation&quot;</span> <span style="color: #000066;">runat</span>=<span style="color: #ff0000;">&quot;server&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br /></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;asp:Content</span> <span style="color: #000066;">ContentPlaceHolderId</span>=<span style="color: #ff0000;">&quot;PlaceHolderMain&quot;</span> <span style="color: #000066;">runat</span>=<span style="color: #ff0000;">&quot;server&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></div></div>
<p><strong>Step 3: </strong>Save your new CustomEdit.aspx into the same directory as EditForm.aspx</p>
<p><strong>Step 4: </strong>Verify your list now is associated with your new CustomEdit.aspx by right clicking on the list in SharePoint Designer and clicking &#8220;Properties&#8221;.<br />
<a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/list-properties.png"><img class="alignnone size-medium wp-image-329" title="list properties" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/list-properties-300x188.png" alt="" width="300" height="188" /></a><br />
Your new edit form should be listed under the Supporting Files tab for Edit item form:<br />
<a href="http://kitmenke.com/blog/wp-content/uploads/2010/12/list-properties-box.png"><img class="alignnone size-medium wp-image-331" title="list properties box" src="http://kitmenke.com/blog/wp-content/uploads/2010/12/list-properties-box-300x291.png" alt="" width="300" height="291" /></a></p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=318&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/12/11/customizing-editform-aspx-in-a-publishing-site/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Autopopulate a SharePoint Form from URL (with SPUtility.js)</title>
		<link>http://kitmenke.com/blog/2010/11/10/autopopulate-a-sharepoint-form-from-url-with-sputility-js/</link>
		<comments>http://kitmenke.com/blog/2010/11/10/autopopulate-a-sharepoint-form-from-url-with-sputility-js/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 02:34:35 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SPUtility.js]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MOSS2007]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=297</guid>
		<description><![CDATA[This post is the sequel to my first post: Autopopulate a SharePoint Form from URL. Let&#8217;s use the same example, but this time take advantage of SPUtility.js (the open source JavaScript library I maintain). Our page&#8217;s URL would be something like: /Lists/ProjectTasks/NewForm.aspx?projectID=523 I want to take the &#8216;projectID&#8217; URL parameter and autopopulate my Project ID [...]]]></description>
			<content:encoded><![CDATA[<p>This post is the sequel to my first post:<a title="Permanent Link to Autopopulate a SharePoint Form from URL" rel="bookmark" href="http://kitmenke.com/blog/2010/03/11/autopopulate-a-sharepoint-form-from-url/"> Autopopulate a SharePoint Form from URL</a>.</p>
<p>Let&#8217;s use the same example, but this time take advantage of <a href="http://sputility.codeplex.com/">SPUtility.js</a> (the open source JavaScript library I maintain).</p>
<p><span id="more-297"></span></p>
<p>Our page&#8217;s URL would be something like:</p>
<pre lang="text" escaped="true">/Lists/ProjectTasks/NewForm.aspx?projectID=523</pre>
<p>I want to take the &#8216;projectID&#8217; URL parameter and autopopulate my Project ID field with this value. Then, we&#8217;ll make the field read only.</p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/03/projectid.png"><img class="alignnone size-full wp-image-238" title="Project ID field" src="http://kitmenke.com/blog/wp-content/uploads/2010/03/projectid.png" alt="" width="258" height="32" /></a></p>
<p>We&#8217;ll dive right into the code:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;script type=&quot;text/javascript&quot; src=&quot;/path/to/prototype.js&quot;&gt;&lt;/script&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;/path/to/SPUtility.js&quot;&gt;&lt;/script&gt;<br />
<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><br />
<br />
<span style="color: #003366; font-weight: bold;">function</span> GetValueFromURL<span style="color: #009900;">&#40;</span>queryParamName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
    <span style="color: #003366; font-weight: bold;">var</span> queryParams <span style="color: #339933;">=</span> location.<span style="color: #660066;">href</span>.<span style="color: #660066;">toQueryParams</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>queryParams <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> queryParams<span style="color: #009900;">&#91;</span>queryParamName<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">decodeURI</span><span style="color: #009900;">&#40;</span>queryParams<span style="color: #009900;">&#91;</span>queryParamName<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span><span style="color: #3366CC;">'load'</span><span style="color: #339933;">,</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><br />
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
      <span style="color: #003366; font-weight: bold;">var</span> urlValue <span style="color: #339933;">=</span> GetValueFromURL<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'projectID'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
      SPUtility.<span style="color: #660066;">GetSPField</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Project ID'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">SetValue</span><span style="color: #009900;">&#40;</span>urlValue<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">MakeReadOnly</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>ex.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
    <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<p>To install, you&#8217;d simply place the JavaScript above into a Content Editor Web Part on your NewForm.aspx or EditForm.aspx. Take a look at the <a href="http://sputility.codeplex.com/wikipage?title=Installation&amp;referringTitle=Documentation">SPUtility.js Installation</a> page for detailed instructions.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=297&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/11/10/autopopulate-a-sharepoint-form-from-url-with-sputility-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wrap ListViewWebPart Column Headers</title>
		<link>http://kitmenke.com/blog/2010/07/08/wrap-listviewwebpart-colum-headers/</link>
		<comments>http://kitmenke.com/blog/2010/07/08/wrap-listviewwebpart-colum-headers/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 18:55:58 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[MOSS2007]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=258</guid>
		<description><![CDATA[I recently got asked if it was possible wrap the column headers in a list view web part. The user had a WebPart with quite a few columns with long names and was trying to prevent the page from scrolling left to right. What we needed to do was wrap the column header so that [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got asked if it was possible wrap the column headers in a list view web part. The user had a WebPart with quite a few columns with long names and was trying to prevent the page from scrolling left to right.<br />
<span id="more-258"></span></p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/07/2010-07-08-13-48-02.png"><img class="alignnone size-full wp-image-259" title="Column Header (nowrap)" src="http://kitmenke.com/blog/wp-content/uploads/2010/07/2010-07-08-13-48-02.png" alt="Column Header (nowrap)" width="600" height="165" /></a></p>
<p>What we needed to do was wrap the column header so that it fit more to the data in the grid.</p>
<p><a href="http://kitmenke.com/blog/wp-content/uploads/2010/07/2010-07-08-13-47-27.png"><img class="alignnone size-full wp-image-260" title="Column Header (wrapped)" src="http://kitmenke.com/blog/wp-content/uploads/2010/07/2010-07-08-13-47-27.png" alt="Column Header (wrapped)" width="600" height="165" /></a></p>
<p>The solution is relatively simple to implement; all you need is a Content Editor Webpart at the bottom of the page somewhere with the following JavaScript in it:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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> <br />
<span style="color: #003366; font-weight: bold;">function</span> WrapColumnHeaderText<span style="color: #009900;">&#40;</span>columnName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> tables <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> tables.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// find the table that is for the column we're looking for</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> attrItem <span style="color: #339933;">=</span> tables<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">attributes</span>.<span style="color: #660066;">getNamedItem</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;displayname&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">!=</span> attrItem <span style="color: #339933;">&amp;&amp;</span> attrItem.<span style="color: #660066;">nodeValue</span> <span style="color: #339933;">===</span> columnName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cells <span style="color: #339933;">=</span> tables<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;td&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>c <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> c <span style="color: #339933;">&lt;</span> cells.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> c<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">!=</span> cells<span style="color: #009900;">&#91;</span>c<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">attributes</span>.<span style="color: #660066;">getNamedItem</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;nowrap&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cells<span style="color: #009900;">&#91;</span>c<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">attributes</span>.<span style="color: #660066;">removeNamedItem</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;nowrap&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// after removing nowrap, IE won't actually wrap the content</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// until it &quot;changes&quot;.. so we touch it to force it to wrap</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cells<span style="color: #009900;">&#91;</span>c<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> cells<span style="color: #009900;">&#91;</span>c<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>ex.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">function</span> WrapColumnHeaders<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// TODO: repeat the line below to wrap more columns</span><br />
&nbsp; &nbsp; WrapColumnHeaderText<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Company Product Code&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
_spBodyOnLoadFunctionNames.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;WrapColumnHeaders&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></div>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=258&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/07/08/wrap-listviewwebpart-colum-headers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Danger in using SPSite.OpenWeb()</title>
		<link>http://kitmenke.com/blog/2009/06/08/the-danger-in-using-spsiteopenweb/</link>
		<comments>http://kitmenke.com/blog/2009/06/08/the-danger-in-using-spsiteopenweb/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 22:37:39 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[MOSS2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=61</guid>
		<description><![CDATA[The SPWeb.OpenWeb() no argument constructor is very useful when it is used within a WebPart. However, if used in a console application, it cause some unexpected behavior for URLs that do not exist.]]></description>
			<content:encoded><![CDATA[<p>Recently I ran into a &#8220;feature&#8221; of SharePoint&#8217;s SPSite.OpenWeb() method (the no argument constructor specifically). If the OpenWeb() method is used with a URL that is not known to exist, it can result in some unexpected behavior.</p>
<p><span id="more-61"></span></p>
<p>Assuming you have the following site structure&#8230;</p>
<ul>
<li>SiteCollection
<ul>
<li>Subsite1</li>
<li>Subsite2</li>
<li>&#8230;</li>
</ul>
</li>
</ul>
<p>Can you find the bug?</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008080; font-style: italic;">// !!! warning !!!</span><br />
<span style="color: #008080; font-style: italic;">// !!! dangerous code ahead !!!</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> server <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://myserver&quot;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> siteUrl <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;/sites/SiteCollection/This Subsite Does Not Exist&quot;</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>SPSite site <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPSite<span style="color: #008000;">&#40;</span>server <span style="color: #008000;">+</span> siteUrl<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
<span style="display:block;background-color:#ffff66">    <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>SPWeb web <span style="color: #008000;">=</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">OpenWeb</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br /></span>    <span style="color: #008000;">&#123;</span><br />
        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>site<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>web<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
    <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></td></tr></tbody></table></div>
<p>The problem reveals itself when the URL&#8217;s are printed. Output:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://myserver/sites/SiteCollection<br />
http://myserver/sites/SiteCollection</div></div>
<p>The URL for the SPWeb that was just opened is the same as the SPSite&#8217;s URL: http://myserver/sites/SiteCollection. <strong>There is no exception thrown.</strong></p>
<p>The behavior I expected, would be some sort of exception when opening a web that does not exist. Even worse is the fact that no error is thrown; it simply defaults to the top level site collection that exists. This means, you get the <strong><span style="color: #ff0000;">wrong</span></strong> SPWeb object. This error can happen when you use the no argument OpenWeb method call.</p>
<p>A better way to get an SPWeb object passes an argument to <a href="http://msdn.microsoft.com/en-us/library/ms474633%28v=office.12%29.aspx">OpenWeb</a>  (updated 7/13/09 per Rikard&#8217;s comment):</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008080; font-style: italic;">// better code to open a web</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> server <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;http://myserver&quot;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> siteUrl <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;/sites/SiteCollection&quot;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> subSite <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;This Subsite Does Not Exist&quot;</span><span style="color: #008000;">;</span><br />
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>SPSite site <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPSite<span style="color: #008000;">&#40;</span>server <span style="color: #008000;">+</span> siteUrl<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
    <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>SPWeb web <span style="color: #008000;">=</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">OpenWeb</span><span style="color: #008000;">&#40;</span>subSite<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><br />
    <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>web<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// do work with the web...</span><br />
        &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>site<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
        &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>web<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
    <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></td></tr></tbody></table></div>
<p>This code should be able to safely open a web at any location.  Keep in mind, trying to access any of the properties of a web that does not exist will result in:</p>
<blockquote><p>System.IO.FileNotFoundException: There is no Web named &#8220;/sites/SiteCollection&#8221;.</p></blockquote>
<p>Again, the exception is not thrown in the constructor, but when attempting to access the SPWeb&#8217;s properties&#8230; such as web.Url.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=61&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2009/06/08/the-danger-in-using-spsiteopenweb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Failed to extract the cab file in the solution.</title>
		<link>http://kitmenke.com/blog/2009/05/27/failed-to-extract-the-cab-file-in-the-solution/</link>
		<comments>http://kitmenke.com/blog/2009/05/27/failed-to-extract-the-cab-file-in-the-solution/#comments</comments>
		<pubDate>Wed, 27 May 2009 18:49:31 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[MOSS2007]]></category>
		<category><![CDATA[Solution]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=33</guid>
		<description><![CDATA[Got the following message when trying to deploy a solution file to the server: Failed to extract the cab file in the solution. Luckily Robert Bogue had already found the answer: we had duplicated an entry for a web part in our solution&#8217;s .ddf file. Apparently, makecab allows you to have the same file in [...]]]></description>
			<content:encoded><![CDATA[<p>Got the following message when trying to deploy a solution file to the server:</p>
<blockquote><p>Failed to extract the cab file in the solution.</p></blockquote>
<p>Luckily <a href="http://thorprojects.com/blog/archive/2008/01/21/stsadm-strikes-again-failed-to-extract-the-cab-file-in-the-solution-.aspx">Robert Bogue</a> had already found the answer: we had duplicated an entry for a web part in our solution&#8217;s .ddf file. Apparently, makecab allows you to have the same file in the same location multiple times. I&#8217;m not really sure why it doesn&#8217;t just overwrite it, but in any case, the solution doesn&#8217;t know what to do with it either.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=33&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2009/05/27/failed-to-extract-the-cab-file-in-the-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enterprise Search and SharePoint</title>
		<link>http://kitmenke.com/blog/2009/05/21/enterprise-search-sql-and-sharepoint/</link>
		<comments>http://kitmenke.com/blog/2009/05/21/enterprise-search-sql-and-sharepoint/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:48:28 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Enterprise Search]]></category>
		<category><![CDATA[ESSQL]]></category>
		<category><![CDATA[MOSS2007]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=18</guid>
		<description><![CDATA[I&#8217;ve learned a couple of different things from messing with Enterprise Search and SharePoint. A lot of this has to do with the initial setup and how different crawls affect the index. What this assumes: You know how to get to Central Admin and the Search Admin screens Any URLs below you will have to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve learned a couple of different things from messing with Enterprise Search and SharePoint. A lot of this has to do with the initial setup and how different crawls affect the index.</p>
<p>What this assumes:</p>
<ul>
<li>You know how to get to Central Admin and the Search Admin screens</li>
<li>Any URLs below you will have to replace &#8220;centraladmin&#8221; with your own server ip</li>
<li>The place where you can run incremental or full crawls is:
<p>http://centraladmin/ssp/admin/_layouts/listcontentsources.aspx</li>
</ul>
<p>Metadata properties:</p>
<ul>
<li>In order to have more columns to search, you must add them to the &#8220;Metadata&#8221;  in the ssp
<p>http://centraladmin/ssp/admin/_layouts/schema.aspx</li>
<li>Any metadata property has a 64 character limit when querying using Enterprise Search SQL (ESSQL)</li>
<li>In order for a column to show up in the Add Mapping dialog an  <strong><span style="text-decoration: underline;">INCREMENTAL</span></strong> crawl is required (column existed and just  didn&#8217;t have data in&#8230; added some data to the list making sure to populate the  new fields and then ran an incremental)</li>
<li>Adding a Managed Property requires a <strong><span style="text-decoration: underline;">FULL</span></strong> crawl in  order to populate the data in that field</li>
</ul>
<p>Search visibility:</p>
<ul>
<li>If a site has Search Visibility disabled, it will show up as a warning in  the crawl log. LISTS DO NOT</li>
<li>Changing a list&#8217;s Search Visibility (in advanced settings) will require a  <strong><span style="text-decoration: underline;">INCREMENTAL</span></strong> (full is not required) crawl in order to  start showing up in search results</li>
</ul>
<p>Search scopes:</p>
<ul>
<li>Changing an existing search scope requires you to update the scope  again<br />
Go back to Central Admin -&gt; ssp -&gt; Search Settings -&gt;  Start Updating<br />
After clicking Update&#8230; it almost always goes from 0% to 100%  after a while&#8230; no in between</li>
<li>Changing scopes does not require an incremental or full crawl (you simply  need to update the scope again) see above</li>
<li>For a search scope, to have it include list items your scope should have a &#8220;folder&#8221; with a value like (encoded url with trailing slash):
<p>http://moss/sitecollection/subsite/Lists/My%20List%20Name/</li>
</ul>
<p>Also, here is some very <strong>unhelpful</strong> microsoft documentation:<br />
<a href="http://msdn.microsoft.com/en-us/library/ms493660.aspx">http://msdn.microsoft.com/en-us/library/ms493660.aspx</a></p>
<p>Leave a comment if you have questions!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=18&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2009/05/21/enterprise-search-sql-and-sharepoint/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

