<?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>tim laqua dot com &#187; version one</title>
	<atom:link href="http://timlaqua.com/tag/version-one/feed/" rel="self" type="application/rss+xml" />
	<link>http://timlaqua.com</link>
	<description>Thoughts and Code from Tim Laqua</description>
	<lastBuildDate>Sun, 09 May 2010 15:25:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>VersionOne Nag: Reminding Us To Burn Our Points</title>
		<link>http://timlaqua.com/2010/02/versionone-nag-reminding-us-to-burn-our-points/</link>
		<comments>http://timlaqua.com/2010/02/versionone-nag-reminding-us-to-burn-our-points/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 04:19:41 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Scripts & Code]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[version one]]></category>

		<guid isPermaLink="false">http://timlaqua.com/?p=341</guid>
		<description><![CDATA[You'll forget - we all do. After a hard day of work, the last thing that pops in to your head is "hey, I should go update this story in VersionOne before I go home." Oh no, the only thing you're thinking about is how bad traffic will be, what you're having for dinner, your [...]]]></description>
			<content:encoded><![CDATA[<p>You'll forget - we all do.  After a hard day of work, the last thing that pops in to your head is "hey, I should go update this story in VersionOne before I go home."  Oh no, the only thing you're thinking about is how bad traffic will be, what you're having for dinner, your trip to Seattle, which bar has the best drink specials tonight, etc.  So accepting that we forget to burn points now and then, why don't we just make a script to remind us?  While you're at it, might as well add a reminder for when you accidentally close a story without setting the ToDo points to zero.</p>
<p>Luckily, since you obviously use VersionOne (because it's the gold standard), there's an API for that:<br />
<span id="more-341"></span><br />
<em>Note:  The following script will request your VersionOne username and password via Read-Host - if you want this to run every day at 4pm, you need to embed your username and password somewhere (securestring support in powershell is helpful, but still - nothing's perfect in this scenario unless you can use LDAP auth)</em></p>
<p><strong>PowerShell script: v1Nag.ps1</strong></p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #800080;">$emailFrom</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;whoever.replies@shouldgoto.com&quot;</span>
<span style="color: #800080;">$emailSMTPServer</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;your.smtpserver.com&quot;</span>
<span style="color: #800080;">$teamName</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Your Team Name in VersionOne&quot;</span>
&nbsp;
<span style="color: #800080;">$url</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;https://wwwXXX.v1host.com/yourhostingid/&quot;</span>
<span style="color: #800080;">$username</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Read-Host</span> <span style="color: #800000;">&quot;User&quot;</span>
<span style="color: #800080;">$password</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Read-Host</span> <span style="color: #008080; font-style: italic;">-assecurestring</span> <span style="color: #800000;">&quot;Password&quot;</span>
&nbsp;
<span style="color: #800080;">$password</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span>System.Runtime.InteropServices.Marshal<span style="color: #000000;">&#93;</span>::PtrToStringAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#91;</span>System.Runtime.InteropServices.Marshal<span style="color: #000000;">&#93;</span>::SecureStringToBSTR<span style="color: #000000;">&#40;</span><span style="color: #800080;">$password</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$apiClient</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">resolve-path</span> <span style="color: #800000;">&quot;versionone.sdk.apiclient.dll&quot;</span>
<span style="color: #800080;">$objectModel</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">resolve-path</span> <span style="color: #800000;">&quot;versionone.sdk.objectmodel.dll&quot;</span>
<span style="color: #000000;">&#91;</span>Reflection.Assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadFrom</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$apiClient</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">&gt;</span> <span style="color: #800080;">$NULL</span>
<span style="color: #000000;">&#91;</span>Reflection.Assembly<span style="color: #000000;">&#93;</span>::<span style="color: #800000;">LoadFrom</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$objectModel</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">&gt;</span> <span style="color: #800080;">$NULL</span>
<span style="color: #800080;">$v1</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> VersionOne.SDK.ObjectModel.V1Instance<span style="color: #000000;">&#40;</span> <span style="color: #800080;">$url</span><span style="color: pink;">,</span> <span style="color: #800080;">$username</span><span style="color: pink;">,</span> <span style="color: #800080;">$password</span><span style="color: #000000;">&#41;</span>
<span style="color: #800080;">$v1</span>.Validate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$sf</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> VersionOne.SDK.ObjectModel.Filters.StoryFilter
<span style="color: #800080;">$v1</span>.Get.Iterations<span style="color: #000000;">&#40;</span><span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: pink;">?</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.IsActive <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$sf</span>.Iteration.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;"><span style="color: #000080;">$_</span></span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #800080;">$v1</span>.Get.Teams<span style="color: #000000;">&#40;</span><span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span> <span style="color: pink;">|</span> <span style="color: pink;">?</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.Name <span style="color: #FF0000;">-match</span> <span style="color: #800080;">$teamName</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$sf</span>.Team.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;"><span style="color: #000080;">$_</span></span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span> 
<span style="color: #800080;">$stories</span> <span style="color: pink;">=</span> <span style="color: #800080;">$v1</span>.Get.Stories<span style="color: #000000;">&#40;</span><span style="color: #800080;">$sf</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$memberDetail</span> <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$story</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$stories</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$owner</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$story</span>.Owners<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #800080;">$memberDetail</span>.Contains<span style="color: #000000;">&#40;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> 		
			<span style="color: #800080;">$md</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> PSObject <span style="color: pink;">|</span> <span style="color: #008080; font-weight: bold;">select</span> Email<span style="color: pink;">,</span> DetailEstimate<span style="color: pink;">,</span> ToDo<span style="color: pink;">,</span> Effort<span style="color: pink;">,</span> EffortToday<span style="color: pink;">,</span> DoneWithToDo
			<span style="color: #800080;">$md</span>.Email <span style="color: pink;">=</span> <span style="color: #800080;">$owner</span>.Email;
			<span style="color: #800080;">$md</span>.DetailEstimate <span style="color: pink;">=</span> <span style="color: #000000;">0</span>;
			<span style="color: #800080;">$md</span>.ToDo <span style="color: pink;">=</span> <span style="color: #000000;">0</span>;
			<span style="color: #800080;">$md</span>.Effort <span style="color: pink;">=</span> <span style="color: #000000;">0</span>;
			<span style="color: #800080;">$md</span>.EffortToday <span style="color: pink;">=</span> <span style="color: #000000;">0</span>;
			<span style="color: #800080;">$md</span>.DoneWithToDo <span style="color: pink;">=</span> <span style="color: pink;">@</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #800080;">$memberDetail</span>.Add<span style="color: #000000;">&#40;</span><span style="color: #800080;">$owner</span>.ID<span style="color: pink;">,</span> <span style="color: #800080;">$md</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #800080;">$memberDetail</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#93;</span>.ToDo <span style="color: pink;">+=</span> <span style="color: #800080;">$story</span>.ToDo;
		<span style="color: #800080;">$memberDetail</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#93;</span>.DetailEstimate <span style="color: pink;">+=</span> <span style="color: #800080;">$story</span>.DetailEstimate;
&nbsp;
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$story</span>.ToDo <span style="color: #FF0000;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #FF0000;">-and</span> <span style="color: #800080;">$story</span>.Status.CurrentValue <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;Done&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$memberDetail</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#93;</span>.DoneWithToDo <span style="color: pink;">+=</span> <span style="color: #800080;">$story</span>;
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$effortRecord</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$story</span>.GetEffortRecords<span style="color: #000000;">&#40;</span><span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #800080;">$memberDetail</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#93;</span>.Effort <span style="color: pink;">+=</span> <span style="color: #800080;">$effortRecord</span>.Value;
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$effortRecord</span>.CreateDate <span style="color: #FF0000;">-ge</span> <span style="color: #000000;">&#91;</span>DateTime<span style="color: #000000;">&#93;</span>::Today<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #800080;">$memberDetail</span><span style="color: #000000;">&#91;</span><span style="color: #800080;">$owner</span>.ID<span style="color: #000000;">&#93;</span>.EffortToday <span style="color: pink;">+=</span> <span style="color: #800080;">$effortRecord</span>.Value;
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$smtp</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">new-object</span> Net.Mail.SmtpClient<span style="color: #000000;">&#40;</span><span style="color: #800080;">$emailSMTPServer</span><span style="color: #000000;">&#41;</span>
&nbsp;
<span style="color: #800080;">$memberDetail</span>.Values <span style="color: pink;">|</span> <span style="color: pink;">?</span><span style="color: #000000;">&#123;</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.EffortToday <span style="color: #FF0000;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #FF0000;">-and</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.ToDo <span style="color: #FF0000;">-gt</span> <span style="color: #000000;">0</span><span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$smtp</span>.Send<span style="color: #000000;">&#40;</span><span style="color: #800080;">$emailFrom</span><span style="color: pink;">,</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.Email<span style="color: pink;">,</span> <span style="color: #800000;">&quot;V1 Nag: No Points Burned Down Today&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;Please make sure you have recorded any effort completed on your stories for the day.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #800080;">$memberDetail</span>.Values <span style="color: pink;">|</span> <span style="color: pink;">?</span><span style="color: #000000;">&#123;</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.DoneWithToDo.Count <span style="color: #FF0000;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#125;</span> <span style="color: pink;">|</span> <span style="color: pink;">%</span> <span style="color: #000000;">&#123;</span> <span style="color: #800080;">$smtp</span>.Send<span style="color: #000000;">&#40;</span><span style="color: #800080;">$emailFrom</span><span style="color: pink;">,</span> <span style="color: #800080;"><span style="color: #000080;">$_</span></span>.Email<span style="color: pink;">,</span> <span style="color: #800000;">&quot;V1 Nag: Story Marked As Done With ToDo Balance&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;Please make sure you have zero'd out ToDo on your Completed/Done stories.&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span></pre></div></div>

<p>You'll need to download the .NET SDK and build the requisite DLLs from:<br />
<a href="http://community.versionone.com/Downloads/default.aspx">http://community.versionone.com/Downloads/default.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://timlaqua.com/2010/02/versionone-nag-reminding-us-to-burn-our-points/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
