<?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</title>
	<atom:link href="http://kitmenke.com/blog/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.2</generator>
		<item>
		<title>Workspace permissions and Project.QueuePublish</title>
		<link>http://kitmenke.com/blog/2011/11/17/workspace-permissions-and-project-queuepublish/</link>
		<comments>http://kitmenke.com/blog/2011/11/17/workspace-permissions-and-project-queuepublish/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 22:04:59 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Project Server]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=402</guid>
		<description><![CDATA[Imagine you work for a large company that uses Microsoft Project Server. Since you have many employees, having MSP sync individual permissions for every user to every site is simply not scalable. Instead, you&#8217;d like to use some Active Directory groups that are already set up to manage permissions in the workspace. So you disable [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine you work for a large company that uses Microsoft Project Server. Since you have many employees, having MSP sync individual permissions for every user to every site is simply not scalable. Instead, you&#8217;d like to use some Active Directory groups that are already set up to manage permissions in the workspace.</p>
<p>So you disable the workspace permissions sync in PWA:</p>
<ol>
<li>Navigate to PWA</li>
<li>Click Server Settings</li>
<li>Click Project Workspace Provisioning Settings</li>
<li>Validate that the &#8220;Workspace Permissions&#8221; checkbox is unchecked</li>
</ol>
<p style="text-align: center;"><a href="http://kitmenke.com/blog/wp-content/uploads/2011/11/msp-workspace-permissions.png"><img class="size-medium wp-image-404 aligncenter" title="MSP Workspace Permissions" src="http://kitmenke.com/blog/wp-content/uploads/2011/11/msp-workspace-permissions-300x67.png" alt="Microsoft Project Server Workspace Permissions" width="300" height="67" /></a></p>
<p>Then, perhaps you write some code that is wrapped up in a nice SharePoint feature to manage setting up the permissions yourself. Everything works great&#8230;.</p>
<p>&#8230; until you start getting reports that some user&#8217;s permissions aren&#8217;t quite right for some project sites.</p>
<p><span id="more-402"></span></p>
<p>You investigate and find a whole bunch of permissions with Project Server roles:</p>
<ul>
<li>Readers (Microsoft Office Project Server)</li>
<li>Team members (Microsoft Office Project Server)</li>
<li>Project Managers (Microsoft Office Project Server)</li>
<li>Web Administrators (Microsoft Office Project Server)</li>
</ul>
<p>More investigation into the PWA Manage Queue Jobs page, you also see &#8220;WSS Workspace Create&#8221; coming up in the queue.</p>
<p>Wait&#8230; I thought we disabled the permissions sync! Why is it still syncing from MSP?</p>
<p>If you&#8217;ve read this far, I&#8217;m guessing you&#8217;ve also written some custom code for Project Server using the Project Server Interface (PSI) (or you&#8217;re using the ProjTool app to publish the project). Which means, you&#8217;re probably using the <a href="http://msdn.microsoft.com/en-us/library/gg177147.aspx" target="_blank">Project.QueuePublish</a> method and you probably have something like this:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">string</span> WSS_URL <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// do not create a project site</span><br />
<span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">bool</span> FULL_PUBLISH <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span><br />
jobId <span style="color: #008000;">=</span> Guid<span style="color: #008000;">.</span><span style="color: #0000FF;">NewGuid</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
projectSvc<span style="color: #008000;">.</span><span style="color: #0000FF;">QueuePublish</span><span style="color: #008000;">&#40;</span>jobId, projectId, FULL_PUBLISH, WSS_URL<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>When fullPublish is true, <strong><span style="color: #ff0000;"><span style="color: #000000;">it will also sync permissions from MSP</span> even when it is disabled in workspace provisioning settings</span></strong>. If the project site exists already, it will also sync permissions to that existing site.</p>
<p>The workaround is simple.. set fullPublish to false:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">string</span> WSS_URL <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// do not create a project site</span><br />
<span style="color: #0600FF; font-weight: bold;">const</span> <span style="color: #6666cc; font-weight: bold;">bool</span> FULL_PUBLISH <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// if true, causes the permissions sync</span><br />
jobId <span style="color: #008000;">=</span> Guid<span style="color: #008000;">.</span><span style="color: #0000FF;">NewGuid</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
projectSvc<span style="color: #008000;">.</span><span style="color: #0000FF;">QueuePublish</span><span style="color: #008000;">&#40;</span>jobId, projectId, FULL_PUBLISH, WSS_URL<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>TODO: What is the difference when fullPublish is true vs false?</p>
<p>P.S. If you are managing your own security, I recommend using the SharePoint API to create workspaces instead of PSI methods. After you create the workspace from your project template, you can just link it up to the Project in MSP:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">_project<span style="color: #008000;">.</span><span style="color: #0000FF;">UpdateProjectWorkspaceAddress</span><span style="color: #008000;">&#40;</span>projectUid, newWebName, wssWebAppUid<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=402&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/11/17/workspace-permissions-and-project-queuepublish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web services proxy: Unable to generate a temporary class</title>
		<link>http://kitmenke.com/blog/2011/10/12/web-services-proxy-unable-to-generate-a-temporary-class/</link>
		<comments>http://kitmenke.com/blog/2011/10/12/web-services-proxy-unable-to-generate-a-temporary-class/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 20:09:15 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=395</guid>
		<description><![CDATA[I ran across a strange error while deploying a very simple DLL. It contained only one class; a web services proxy class to the Lists SharePoint web service that I generated using the wsdl tool. Here is the error: Unable to generate a temporary class (result=1). error CS2001: Source file &#8216;C:\WINDOWS\TEMP\_zm3ve2y.0.cs&#8217; could not be found [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across a strange error while deploying a very simple DLL. It contained only one class; a web services proxy class to the Lists SharePoint web service that I generated using the <a href="http://msdn.microsoft.com/en-us/library/d2s8y7bs%28v=vs.80%29.aspx">wsdl</a> tool. Here is the error:</p>
<blockquote><p>Unable to generate a temporary class (result=1).<br />
error CS2001: Source file &#8216;C:\WINDOWS\TEMP\_zm3ve2y.0.cs&#8217; could not be found<br />
error CS2008: No inputs specified</p></blockquote>
<p>Apparently, this is because the generated proxy class uses XmlSerializer somewhere internally. <a href="http://stackoverflow.com/questions/3417412/why-is-asp-net-trying-to-generate-a-temporary-class-for-a-web-service-reference">My guess is that it is de-serializing the soap messages into objects</a>?</p>
<p>Some googling turned up the common answer of &#8220;just give the account access to the temp directory.&#8221; This seemed strange to me (<em>also something our infrastructure team was wary of doing</em>). Eventually I found <a href="http://stackoverflow.com/questions/657993/system-invalidoperationexception-unable-to-generate-a-temporary-class-result-1/658015#658015">this awesome answer by Richard</a>. Essentially your options are:</p>
<ol>
<li>Give the account access to the temp directory</li>
<li>Use the sgen tool to pre-generate the serialization assembly</li>
<li>Not use the proxy class (??)</li>
</ol>
<p>In my opinion, using sgen is the logical choice. The <a href="http://msdn.microsoft.com/en-us/library/bk3w6240%28VS.80%29.aspx">documentation for sgen</a> also puts it pretty clearly:</p>
<blockquote><p>When the XML Serializer Generator is not used, a <strong>XmlSerializer</strong> generates serialization code and a serialization assembly for each type every time an application is run. To improve the performance of XML serialization startup, use the Sgen.exe tool to generate those assemblies the assemblies in advance. These assemblies can then be deployed with the application.</p></blockquote>
<p>So all I needed to do was run this command against the Release version of my DLL:</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">sgen /a:MyAssembly.dll /compiler:/keyfile:../../MyAssembly.snk</div></div>
<p>This will generate another assembly: MyAssembly.XmlSerializers.dll. Cool!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=395&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/10/12/web-services-proxy-unable-to-generate-a-temporary-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web services, XmlNode, and XPATH</title>
		<link>http://kitmenke.com/blog/2011/07/26/web-services-xpath/</link>
		<comments>http://kitmenke.com/blog/2011/07/26/web-services-xpath/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 15:33:18 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=382</guid>
		<description><![CDATA[I was writing a little web services app to help delete individual permissions from a site and thought about trying XPATH on the result to get what I needed. I had some trouble so thought I&#8217;d put together a small example for later reference. The XML from the Permissions GetPermissionCollection web service looks something like: [...]]]></description>
			<content:encoded><![CDATA[<p>I was writing a little web services app to help delete individual permissions from a site and thought about trying XPATH on the result to get what I needed. I had some trouble so thought I&#8217;d put together a small example for later reference.</p>
<p><span id="more-382"></span></p>
<p>The XML from the Permissions <a href="http://msdn.microsoft.com/en-us/library/dd586703%28v=office.11%29.aspx">GetPermissionCollection</a> web service looks something like:</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;GetPermissionCollection</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Permissions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Permission</span> <span style="color: #000066;">MemberID</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">Mask</span>=<span style="color: #ff0000;">&quot;-1&quot;</span> <span style="color: #000066;">MemberIsUser</span>=<span style="color: #ff0000;">&quot;False&quot;</span> <span style="color: #000066;">MemberGlobal</span>=<span style="color: #ff0000;">&quot;True&quot;</span> <span style="color: #000066;">GroupName</span>=<span style="color: #ff0000;">&quot;IT Projects Owners&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Permission</span> <span style="color: #000066;">MemberID</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">Mask</span>=<span style="color: #ff0000;">&quot;138612833&quot;</span> <span style="color: #000066;">MemberIsUser</span>=<span style="color: #ff0000;">&quot;False&quot;</span> <span style="color: #000066;">MemberGlobal</span>=<span style="color: #ff0000;">&quot;True&quot;</span> <span style="color: #000066;">GroupName</span>=<span style="color: #ff0000;">&quot;IT Projects Visitors&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Permission</span> <span style="color: #000066;">MemberID</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">Mask</span>=<span style="color: #ff0000;">&quot;1011028719&quot;</span> <span style="color: #000066;">MemberIsUser</span>=<span style="color: #ff0000;">&quot;False&quot;</span> <span style="color: #000066;">MemberGlobal</span>=<span style="color: #ff0000;">&quot;True&quot;</span> <span style="color: #000066;">GroupName</span>=<span style="color: #ff0000;">&quot;IT Projects Members&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Permission</span> <span style="color: #000066;">MemberID</span>=<span style="color: #ff0000;">&quot;1073741823&quot;</span> <span style="color: #000066;">Mask</span>=<span style="color: #ff0000;">&quot;-1&quot;</span> <span style="color: #000066;">MemberIsUser</span>=<span style="color: #ff0000;">&quot;True&quot;</span> <span style="color: #000066;">MemberGlobal</span>=<span style="color: #ff0000;">&quot;False&quot;</span> <span style="color: #000066;">UserLogin</span>=<span style="color: #ff0000;">&quot;SHAREPOINT\system&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Permissions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GetPermissionCollection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>The main heartache I had when trying to use XPATH was that the XML uses a <strong>default namespace</strong> (the xmlns=&#8221;" part). In order to select the Permission nodes, you need to use a XmlNamespaceManager:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Permissions webSvc <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Permissions<span style="color: #008000;">&#40;</span>site<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
XmlNode result <span style="color: #008000;">=</span> webSvc<span style="color: #008000;">.</span><span style="color: #0000FF;">GetPermissionCollection</span><span style="color: #008000;">&#40;</span>site<span style="color: #008000;">.</span><span style="color: #0000FF;">Name</span>, <span style="color: #666666;">&quot;Web&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
XmlNamespaceManager nsmgr <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> XmlNamespaceManager<span style="color: #008000;">&#40;</span>result<span style="color: #008000;">.</span><span style="color: #0000FF;">OwnerDocument</span><span style="color: #008000;">.</span><span style="color: #0000FF;">NameTable</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
nsmgr<span style="color: #008000;">.</span><span style="color: #0000FF;">AddNamespace</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;sp&quot;</span>, <span style="color: #666666;">&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #6666cc; font-weight: bold;">string</span> xpathQuery <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;sp:Permissions/sp:Permission&quot;</span><span style="color: #008000;">;</span><br />
XmlNodeList nodeList <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">SelectNodes</span><span style="color: #008000;">&#40;</span>xpathQuery, nsmgr<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>Here is <a href="http://stackoverflow.com/questions/4245678/get-sharepoint-list-visible-columns-names-through-web-service-using-c/4249198#4249198">another example on Stackoverflow</a>.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=382&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/07/26/web-services-xpath/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SPUtility.js 0.8 and beyond!</title>
		<link>http://kitmenke.com/blog/2011/04/26/sputility-js-0-8-and-beyond/</link>
		<comments>http://kitmenke.com/blog/2011/04/26/sputility-js-0-8-and-beyond/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 01:18:56 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SPUtility.js]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=361</guid>
		<description><![CDATA[Quick update to SPUtility.js today! I&#8217;ve added support for rich text fields, unchecking multi-select checkboxes, and choice fields with fill-in values. I also have some thoughts on future SPUtility.js updates. Support for rich text fields This is an update to the SPNoteField class. In order to get this working, I had to do some funky [...]]]></description>
			<content:encoded><![CDATA[<p>Quick update to SPUtility.js today! I&#8217;ve added support for rich text fields, unchecking multi-select checkboxes, and choice fields with fill-in values. I also have some thoughts on future SPUtility.js updates.<br />
<span id="more-361"></span></p>
<p><strong>Support for rich text fields</strong></p>
<p>This is an update to the SPNoteField class. In order to get this working, I had to do some funky stuff with internal SharePoint JavaScript functions: <code class="codecolorer text default"><span class="text">RTE_GetEditorIFrame</span></code>, <code class="codecolorer text default"><span class="text">RTE_GetIFrameContents</span></code>, and <code class="codecolorer text default"><span class="text">RTE_TransferTextAreaContentsToIFrame</span></code>.</p>
<p><strong>Support for unchecking multi-select checkboxes</strong></p>
<p>I think this really was a bug, but I found that there was no way to uncheck one of the choices of a multi-select choice field. I updated the SetValue function to take an optional boolean second parameter. Passing it true will check the choice&#8230; false will uncheck.</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: #006600; font-style: italic;">//uncheck the Bravo choice</span><br />
SPUtility.<span style="color: #660066;">GetSPField</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Multiselect Column'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">SetValue</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Bravo'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><strong>Support for choice fields with fill-in values</strong></p>
<p>I finally buckled down and implemented the code to support choice fields with fill-in values. Turns out this was a little more complicated than I first expected. I&#8217;m not sure how this will work with languages other than english because it seems difficult to find the &#8220;Specify your own value&#8221; radio button. It also complicates the SPChoiceField class quite a bit.</p>
<p>Either way, I tried to keep things as simple as possible and keep most of the burden in the library rather than on the developer/user:</p>
<ol>
<li>Detects the presence of the fill-in textbox for every different type of choice field (radio, dropdown, multi-select)</li>
<li><code class="codecolorer text default"><span class="text">SetValue</span></code> is smart: if the value passed is a choice, then that choice is set. If not, then the fill-in value is set.</li>
<li><code class="codecolorer text default"><span class="text">GetValue</span></code> is also able to detect when the fill-in value is present</li>
</ol>
<p>I&#8217;m hoping to break some of this logic down into smaller classes in the future but this will really all be cleanup work on my end. Which leads me into the next part&#8230;</p>
<p><strong>Thoughts about future updates</strong></p>
<p>My wishlist for future updates currently is:</p>
<ol>
<li>Better documentation!<br />
I plan to start using <a href="http://pdoc.org/">PDoc</a> (what Prototype.js uses for it&#8217;s <a href="http://api.prototypejs.org/">API documentation</a>)</li>
<li>To support #1, I&#8217;d like to break SPUtility.js into more manageable chunks and use <a href="https://github.com/sstephenson/sprockets">Sprockets</a></li>
<li>To support #1 and #2, I&#8217;d like to start using github for the day to day version control. This is something I debated but I think I can use it for the full source and still use the codeplex site for the releases. I&#8217;m not sure where I&#8217;ll host the documentation yet.</li>
</ol>
<p>Go download SPUtility.js at <a href="http://sputility.codeplex.com/">http://sputility.codeplex.com/</a>. Feel free to post comments with feedback!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=361&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/04/26/sputility-js-0-8-and-beyond/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Commit to SharePoint Overflow!</title>
		<link>http://kitmenke.com/blog/2011/02/09/commit-to-sharepoint-overflow/</link>
		<comments>http://kitmenke.com/blog/2011/02/09/commit-to-sharepoint-overflow/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 03:43:47 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=356</guid>
		<description><![CDATA[I want to put a quick post out here in support of SharePoint Overflow being migrated to StackExchange v2.0. It is a a great complement to StackOverflow for all things SharePoint related. You can commit here: SharePoint Overflow.]]></description>
			<content:encoded><![CDATA[<p>I want to put a quick post out here in support of SharePoint Overflow being migrated to StackExchange v2.0. It is a a great complement to StackOverflow for all things SharePoint related.</p>
<p>You can commit here: <a href="http://area51.stackexchange.com/proposals/28921/sharepoint-overflow?referrer=Z4tLnJTUhc0nXLaDPCj7kA2">SharePoint Overflow</a>.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=356&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/02/09/commit-to-sharepoint-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPUtility 0.5 Released!</title>
		<link>http://kitmenke.com/blog/2011/01/15/sputility-0-5-released/</link>
		<comments>http://kitmenke.com/blog/2011/01/15/sputility-0-5-released/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 22:15:34 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SPUtility.js]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=348</guid>
		<description><![CDATA[Version 0.5 of SPUtility.js has been released onto the codeplex site! Go check it out! From the changelog, here are some of the updates with more detail: Bug: SPNumberField GetValue() function now disregards commas If the field contained a value like &#8220;1,000&#8243; the value wouldn&#8217;t return as a number correctly. GetValue will now automatically convert [...]]]></description>
			<content:encoded><![CDATA[<p>Version 0.5 of SPUtility.js has been released onto the <a href="http://sputility.codeplex.com/">codeplex site</a>! Go check it out!</p>
<p><span id="more-348"></span></p>
<p>From the <a href="http://sputility.codeplex.com/wikipage?title=Changelog&amp;referringTitle=Home">changelog</a>, here are some of the updates with more detail:</p>
<ol>
<li>Bug: SPNumberField GetValue() function now disregards commas<br />
If the field contained a value like &#8220;1,000&#8243; the value wouldn&#8217;t return as a number correctly. GetValue will now automatically convert the value from a string type into a number (ignores other characters).</li>
<li><em>Breaking change</em>: GetSPFields will now return a hashtable instead of the array (see next item)</li>
<li>GetSPField now loads fields into a hashtable instead of an array  (dramatically increases speed for forms with a large number of fields)<br />
This is related to how SPUtility stores the fields internally. Instead of using an array, it now uses a hashtable which will significantly speed up GetSPField calls&#8230; especially if you have a lot of fields in a list!</li>
<li>GetSPFieldType now attempts to prevent throwing an error when unable to get the field&#8217;s type (allows for easier Firebugging).<br />
This was more of an annoyance than anything.. made it harder to trap errors in Firebug because this method was throwing an error if it couldn&#8217;t parse the type.</li>
<li>New MakeEditable function, will undo MakeReadOnly<br />
Very useful if you want to only allow a field to be edited in certain circumstances.</li>
<li>Support for currency fields. MakeReadOnly will display the value  with dollar sign, and commas. Uses formatMoney function made by Jonas  Raoni Soares Silva.<br />
This leverages a new SPCurrencyField class. Like SPNumberField, GetValue now returns a number. I also developed a Format method but I&#8217;m not sure if this is something I want to include in the scope of SPUtility.js. Basically this function enforces a pretty field value&#8230; for example: $1,250.95 intead of 1250.95.</li>
<li>Support for single select lookup fields<br />
Lookup fields are strange because the field seems to switch modes depending on the number of items in the lookup list. For less than twenty items, a dropdown is used. For twenty or more, an autocomplete is used. It should work for both but I still have more work to do on these in order to make this class bulletproof.</li>
<li>Reformatted code to meet higher JSLint standards<br />
Mostly just whitespace and parentheses but I also refactored functions to have only one var. This helped because I was using var inside a couple loops.</li>
</ol>
<p>Lots of good stuff in this release!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=348&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2011/01/15/sputility-0-5-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Planned updates for SPUtility.js 0.4</title>
		<link>http://kitmenke.com/blog/2010/11/10/planned-updates-for-sputility-js-0-4/</link>
		<comments>http://kitmenke.com/blog/2010/11/10/planned-updates-for-sputility-js-0-4/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 03:12:50 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SPUtility.js]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[SharePoint 2007]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=307</guid>
		<description><![CDATA[SPUtility.js version 0.4 should be getting released soon (week or so??). I wanted to put a quick post out there to highlight some of the upcoming features and fixes. First some fixes: If a field is read only, the label doesn&#8217;t automatically update. Update will allows developer to call MakeReadOnly again to update the label. [...]]]></description>
			<content:encoded><![CDATA[<p>SPUtility.js version 0.4 should be getting released soon (week or so??). I wanted to put a quick post out there to highlight some of the upcoming features and fixes.<br />
<span id="more-307"></span></p>
<p>First some fixes:</p>
<ul>
<li>If a field is read only, the label doesn&#8217;t automatically update.<br />
Update will allows developer to call MakeReadOnly again to update the label. I&#8217;ve been thinking about trying to make the label update automatically when the field value is changed programmatically, but calling MakeReadOnly again should work for now.</li>
<li>New separate number field class that will always return a number (fixes issue with returning strings from a number field).</li>
</ul>
<p>I&#8217;ll be including some new features as well:</p>
<ul>
<li>Support for Yes/No fields. New SPBooleanField class for allows for getting and setting yes/no fields. SetValue takes true or false and GetValue will return true/false.</li>
</ul>
<p>Some TODOs:</p>
<ul>
<li>Support for Rich Text Fields</li>
<li>Support for lookup fields</li>
<li>Getting a SPField by internal column name</li>
</ul>
<p>I also need to update the SPUtility.js documentation to include information about some properties that I&#8217;ve found to be very useful. I wasn&#8217;t sure entirely sure at first if they would come in handy. What am I talking about? Let&#8217;s say we have a requirement from our user to populate a Date field with today&#8217;s date IF they choose a Status of &#8220;Requested&#8221; from the Status single select dropdown. This is easy with SPUtility.js!</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: #003366; font-weight: bold;">var</span> spfStatus <span style="color: #339933;">=</span> SPUtility.<span style="color: #660066;">GetSPField</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Status'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>spfStatus.<span style="color: #660066;">Dropdown</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'change'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Requested'</span> <span style="color: #339933;">==</span> spfStatus.<span style="color: #660066;">Dropdown</span>.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
    <span style="color: #003366; font-weight: bold;">var</span> today <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</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;">'Requested Date'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">SetValue</span><span style="color: #009900;">&#40;</span>today.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> today.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> today.<span style="color: #660066;">getDate</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></div></div>
<p>Using the <code class="codecolorer javascript default"><span class="javascript">SPChoiceField.<span style="color: #660066;">Dropdown</span></span></code> property, we can get the control and observe the onChange event.</p>
<p>I hope to get these features documented with the 0.4 release! As always, any feedback is appreciated; leave me a comment or contact me via Codeplex.</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=307&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/11/10/planned-updates-for-sputility-js-0-4/feed/</wfw:commentRss>
		<slash:comments>0</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>3</slash:comments>
		</item>
		<item>
		<title>Using undefined in JavaScript</title>
		<link>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/</link>
		<comments>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 17:37:52 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=269</guid>
		<description><![CDATA[Working with JavaScript can definitely be painful, but I always love stumbling across interesting and strange features of the language. I just found wtfjs.com which led me to these two answers on stackoverflow. The first answer made me realize that undefined is not a keyword in JavaScript; it actually is a type that also happens [...]]]></description>
			<content:encoded><![CDATA[<p>Working with JavaScript can definitely be painful, but I always love stumbling across interesting and strange features of the language. I just found <a href="http://wtfjs.com/">wtfjs.com</a> which led me to these <a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2008728#2008728">two</a> <a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2010740#2010740">answers</a> on stackoverflow.</p>
<p><span id="more-269"></span></p>
<p><a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2008728#2008728">The first answer</a> made me realize that <code class="codecolorer text default"><span class="text">undefined</span></code> is not a keyword in JavaScript; it actually is a <strong>type</strong> that also happens to have a global variable with the same name. This means that you can change the value of <code class="codecolorer text default"><span class="text">undefined</span></code> (the global variable) to be something else.</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;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> undefined <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">true</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> undefined <span style="color: #339933;">=</span> <span style="color: #CC0000;">42</span><br />
<span style="color: #CC0000;">42</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> undefined <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">false</span></div></div>
<p>And, like shown above, the correct way to check if a variable is <code class="codecolorer text default"><span class="text">undefined</span></code> is by using <code class="codecolorer text default"><span class="text">typeof</span></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"><span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #003366; font-weight: bold;">var</span> myVariable<span style="color: #339933;">;</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> myVariable<br />
<span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> myVariable <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #CC0000;">1</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> myVariable<br />
<span style="color: #3366CC;">&quot;number&quot;</span></div></div>
<p><a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2010740#2010740">The second feature</a>, is something that I often used but had no idea why it actually worked: <code class="codecolorer text default"><span class="text">void(0)</span></code>.</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:void(0)&quot;</span>&gt;</span>do nothing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span></div></div>
<p>According to Breton&#8217;s excellent explanation, <code class="codecolorer text default"><span class="text">void</span></code> is actually a prefix operator. When you prefix any expression with <code class="codecolorer text default"><span class="text">void</span></code>, the result evaluates to <code class="codecolorer text default"><span class="text">undefined</span></code>. So, using our <em>correct</em> method for checking <code class="codecolorer text default"><span class="text">undefined</span></code> above you get this in the console:</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;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> <span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">true</span></div></div>
<p>Awesome!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=269&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

