<?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"
	>

<channel>
	<title>novolocus.com &#187; 2006 &#187; August</title>
	<atom:link href="http://www.novolocus.com/2006/08/feed" rel="self" type="application/rss+xml" />
	<link>http://www.novolocus.com</link>
	<description>Whatever Andy Burns is working on...</description>
	<pubDate>Mon, 05 Jan 2009 16:14:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Configuration Information for Workflows</title>
		<link>http://www.novolocus.com/2006/08/31/configuration-information-for-workflows/</link>
		<comments>http://www.novolocus.com/2006/08/31/configuration-information-for-workflows/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 11:08:51 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=158</guid>
		<description><![CDATA[In the workflow I&#8217;m working on, some xPaths. I don&#8217;t want to hard code them, as this is the sort of crap that always changes. However, I&#8217;m not sure where a good place to store such properties would be. I&#8217;d figured the workflow.xml file, or even features.xml,  but I didn&#8217;t find information about doing [...]]]></description>
			<content:encoded><![CDATA[<p>In the workflow I&#8217;m working on, some xPaths. I don&#8217;t want to hard code them, as this is the sort of crap that always changes. However, I&#8217;m not sure where a good place to store such properties would be. I&#8217;d figured the workflow.xml file, or even features.xml,  but I didn&#8217;t find information about doing this. All it&#8217;d need is a series of properties and values, but neither seems to do that.</p>
<p>I guess I <em>could</em> write an association form - but given that this workflow will only be used on one list, and that the settings shouldn&#8217;t change very often, this would be like using an anti-aircraft gun to kill a mosquito.</p>
<p>It is really frustrating to have simple tasks, no documentation, and no answers. I mean, come on guys, all I want to know is the right way to install a config data, and access it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/31/configuration-information-for-workflows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Confusing Modification Forms and State Machines</title>
		<link>http://www.novolocus.com/2006/08/31/confusing-modification-forms-and-state-machines/</link>
		<comments>http://www.novolocus.com/2006/08/31/confusing-modification-forms-and-state-machines/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 11:08:46 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Workflow]]></category>

		<category><![CDATA[Infopath]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=159</guid>
		<description><![CDATA[I&#8217;m building a state machine workflow for MOSS, but as part of this we need to be able to reassign tasks to other users (in case someone is ill, on holiday, etc.)
The ECM Sample Starter Kit has an example that uses an Infopath Modification form to do just that. Looking at the code for it, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m building a state machine workflow for MOSS, but as part of this we need to be able to reassign tasks to other users (in case someone is ill, on holiday, etc.)</p>
<p>The <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=38CA6B32-44BE-4489-8526-F09C57CD13A5&amp;displaylang=en">ECM Sample Starter Kit </a>has an example that uses an Infopath Modification form to do just that. Looking at the code for it, I can see how it has an &#8216;EnableWorkflowModification&#8217; step to, well, enable a modification form, and I looked this up on the MSDN site.</p>
<p>The MSDN site pages I looked at <a href="http://msdn2.microsoft.com/en-us/library/ms550177.aspx">here</a> and <a href="http://msdn2.microsoft.com/en-us/library/ms480794.aspx">here</a> discuss the scope of the enabled form. However, this seems to be related to the step  it is contained  within a sequential workflow. This, presumably, doesn&#8217;t apply in a state machine workflow? Or maybe it applies to the whole state (i.e. the state <strong>is</strong> the scope)- which raises questions as a state might be reached by many routes, without enabling the modification.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/31/confusing-modification-forms-and-state-machines/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on Updating SharePoint Workflow Tasks</title>
		<link>http://www.novolocus.com/2006/08/31/more-on-updating-sharepoint-workflow-tasks/</link>
		<comments>http://www.novolocus.com/2006/08/31/more-on-updating-sharepoint-workflow-tasks/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 10:08:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Workflow]]></category>

		<category><![CDATA[Tasks]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=160</guid>
		<description><![CDATA[So, I&#8217;ve continued investigating my problems updating a SharePoint Workflow Task. I decided to learn about event receivers, as this is what the message was about.
Event receivers, well, receive events that happen on an item, and process them. I listed the ones on my workflow task list with the following code:
for (int j = 0; [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve continued investigating my problems <a href="http://www.novolocus.com/display.php?id=303">updating a SharePoint Workflow Task</a>. I decided to learn about event receivers, as this is what the message was about.</p>
<p>Event receivers, well, receive events that happen on an item, and process them. I listed the ones on my workflow task list with the following code:</p>
<p><code>for (int j = 0; j &lt; myList.EventReceivers.Count; j++)<br />
{<br />
SPEventReceiverDefinition d = myList.EventReceivers[j];<br />
Log (d.Assembly  + &#8221; - &#8221; + d.Class  + &#8221; - &#8221; + d.Data  + &#8221; - &#8221; + d.Filter  + &#8221; - &#8221; + d.Name  + &#8221; - &#8221; + d.Type.ToString());<br />
}</code></p>
<p>This gave the the results:</p>
<blockquote><p>31/08/2006 11:13:57 - Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c - Microsoft.SharePoint.Workflow.WorkflowTaskUpdateEventReceiver -  -  -  - ItemAdding</p>
<p>31/08/2006 11:13:57 - Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c - Microsoft.SharePoint.Workflow.WorkflowTaskUpdateEventReceiver -  -  -  - ItemUpdating</p>
<p>31/08/2006 11:13:57 - Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c - Microsoft.SharePoint.Workflow.WorkflowTaskUpdateEventReceiver -  -  -  - ItemDeleting</p>
<p>31/08/2006 11:13:57 -  -  -  -  -  - 32767</p></blockquote>
<p>It turns out that there is <a href="http://sharethispoint.com/archive/2006/07/13/10.aspx">an easier way of list the event receivers</a>, but dumping to a log file works. Interestingly, <a href="http://sharethispoint.com/archive/2006/07/13/10.aspx">he also had the same 32767</a> result, which is weird. It&#8217;s (2^15)-1, so presumably the highest value that can be represented by a 16bit signed integer - but what is it doing in my log?</p>
<p>Anyway, I reckon that the ItemUpdating event receiver is killing my update - but don&#8217;t effing know why.</p>
<p>Incidentally, <a href="http://blah.winsmarts.com/Post.aspx?postID=68">this is a good article demonstrating event receivers</a>. Shame about the bugs they&#8217;re finding, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/31/more-on-updating-sharepoint-workflow-tasks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updating SharePoint &#8216;Workflow Tasks&#8217;</title>
		<link>http://www.novolocus.com/2006/08/31/updating-sharepoint-workflow-tasks/</link>
		<comments>http://www.novolocus.com/2006/08/31/updating-sharepoint-workflow-tasks/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 08:08:35 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Workflow]]></category>

		<category><![CDATA[Tasks]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=161</guid>
		<description><![CDATA[Problems doing the simplest things. I want to update a task created by the CreateTask activity, when the activity is changed. I have the following function, which is run when the Task list item  is edited&#8230;
private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
{
SPWeb mySite = new SPSite(workflowProperties.SiteId).OpenWeb(workflowProperties.WebId);
SPList myList = mySite.Lists[workflowProperties.TaskListId];
SPListItem myTask = myList.GetItemById(TaskBeforeProperties.TaskItemId);
SPUser myUser = mySite.AllUsers[e.Identity];
myTask["Assigned [...]]]></description>
			<content:encoded><![CDATA[<p>Problems doing the simplest things. I want to update a task created by the CreateTask activity, when the activity is changed. I have the following function, which is run when the Task list item  is edited&#8230;</p>
<p><code>private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)<br />
{<br />
SPWeb mySite = new SPSite(workflowProperties.SiteId).OpenWeb(workflowProperties.WebId);<br />
SPList myList = mySite.Lists[workflowProperties.TaskListId];<br />
SPListItem myTask = myList.GetItemById(TaskBeforeProperties.TaskItemId);<br />
SPUser myUser = mySite.AllUsers[e.Identity];<br />
myTask["Assigned To"] = myUser;<br />
myTask.Update();<br />
}<br />
</code></p>
<p>Everything seems okay, but when I call myTask.Update(), I get the exception &#8220;An event receiver has cancelled the request.&#8221; And I&#8217;m damned if I know why.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/31/updating-sharepoint-workflow-tasks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Lock picking&#8230; &#8230;well, bumping</title>
		<link>http://www.novolocus.com/2006/08/25/lock-picking-well-bumping/</link>
		<comments>http://www.novolocus.com/2006/08/25/lock-picking-well-bumping/#comments</comments>
		<pubDate>Fri, 25 Aug 2006 14:08:56 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[A Bit Random]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=163</guid>
		<description><![CDATA[Interesting and slightly worrying way of Opening a lock by &#8216;bumping&#8217; it
]]></description>
			<content:encoded><![CDATA[<p>Interesting and slightly worrying way of <a href="http://www.engadget.com/2006/08/24/the-lockdown-locked-but-not-secure-part-i/">Opening a lock by &#8216;bumping&#8217; it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/25/lock-picking-well-bumping/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Error in SharePoint Logs - Load Workflow Assembly: System.IO.FileNotFoundException</title>
		<link>http://www.novolocus.com/2006/08/16/error-in-sharepoint-logs-load-workflow-assembly-systemiofilenotfoundexception/</link>
		<comments>http://www.novolocus.com/2006/08/16/error-in-sharepoint-logs-load-workflow-assembly-systemiofilenotfoundexception/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 13:08:59 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=166</guid>
		<description><![CDATA[This one puzzled - the file name in the Workflow.xml &#8216;CodeBesideAssembly&#8217; was correct, and I thought the PublicKeyToken was okay too. Turned out that the &#8216;version&#8217; was wrong - it seems to start at 3.0.0.0, but my assembly was only 1.0.0.0. Dunno why that was.
]]></description>
			<content:encoded><![CDATA[<p>This one puzzled - the file name in the Workflow.xml &#8216;CodeBesideAssembly&#8217; was correct, and I thought the PublicKeyToken was okay too. Turned out that the &#8216;version&#8217; was wrong - it seems to start at 3.0.0.0, but my assembly was only 1.0.0.0. Dunno why that was.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/16/error-in-sharepoint-logs-load-workflow-assembly-systemiofilenotfoundexception/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting the Public Key Token without copying things into the GAC</title>
		<link>http://www.novolocus.com/2006/08/16/getting-the-public-key-token-without-copying-things-into-the-gac/</link>
		<comments>http://www.novolocus.com/2006/08/16/getting-the-public-key-token-without-copying-things-into-the-gac/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 09:08:47 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=167</guid>
		<description><![CDATA[1) Create your Key pair, as per normal. Typically, this can be done as:
Sn.exe -k PublicPrivateKeyPair.snk
This will create a file containing both keys.
2) Extract the public key:
Sn.exe -p PublicPrivateKeyPair.snk PublicOnly.snk
3) Calculate the token. Note that the &#8216;-t&#8217; parameter MUST be lower case (&#8217;-T&#8217; does something different)
Sn.exe -t 'PublicOnly.snk'
And there you have the public key token
]]></description>
			<content:encoded><![CDATA[<p>1) Create your Key pair, as per normal. Typically, this can be done as:<br />
<code>Sn.exe -k PublicPrivateKeyPair.snk</code><br />
This will create a file containing both keys.</p>
<p>2) Extract the public key:<br />
<code>Sn.exe -p PublicPrivateKeyPair.snk PublicOnly.snk</code></p>
<p>3) Calculate the token. Note that the &#8216;-t&#8217; parameter MUST be lower case (&#8217;-T&#8217; does something different)<br />
<code>Sn.exe -t 'PublicOnly.snk'</code><br />
And there you have the public key token</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/16/getting-the-public-key-token-without-copying-things-into-the-gac/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Update Infopath forms from within Workflow</title>
		<link>http://www.novolocus.com/2006/08/15/update-infopath-forms-from-within-workflow/</link>
		<comments>http://www.novolocus.com/2006/08/15/update-infopath-forms-from-within-workflow/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 11:08:37 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Infopath]]></category>

		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=168</guid>
		<description><![CDATA[So, I had been asked to write some code to update an Infopath form&#8217;s data as it passed through a workflow. This data was being declared as a column in SharePoint, and we wanted the columns value to update. A long struggle ensued&#8230;
Right, so, I started with some code to get a SharePoint column, update [...]]]></description>
			<content:encoded><![CDATA[<p>So, I had been asked to write some code to update an Infopath form&#8217;s data as it passed through a workflow. This data was being declared as a column in SharePoint, and we wanted the columns value to update. A long struggle ensued&#8230;<span id="more-168"></span></p>
<p>Right, so, I started with some code to get a SharePoint column, update the column, and save the changes.</p>
<p><code><br />
SPWeb myWeb = new<br />
SPSite(workflowProperties.SiteId).OpenWeb(workflowProperties.WebId);</code></p>
<p>SPListItem myItem =<br />
myWeb.Lists[workflowProperties.ListId].<br />
GetItemById(workflowProperties.ItemId);</p>
<p><code>myItem.Properties["Column Name"] = &#8220;Column Value&#8221;;<br />
myItem.Update();</code></p>
<p>This worked a treat - but only for columns defined normally. Columns being read from the form lost their values as soon as the update() function was run.</p>
<p>And that was the problem - the values were being read from the form data, the XML. I had hoped that SharePoint would be clever enough to write back into the XML - it isn&#8217;t. Instead, it appears you have to do this by hand&#8230;</p>
<p>First, get the SharePoint Listitem</p>
<p><code><br />
SPWeb myWeb = new SPSite(workflowProperties.SiteId).<br />
OpenWeb(workflowProperties.WebId);<br />
SPListItem myItem = myWeb.Lists[workflowProperties.ListId].<br />
GetItemById(workflowProperties.ItemId);<br />
</code></p>
<p>Then get the File for that ListItem - i.e. the XML data</p>
<p><code><br />
SPFile myFile = myItem.File;<br />
MemoryStream myInStream = new MemoryStream(myFile.OpenBinary());<br />
XmlDocument myDoc = new XmlDocument();<br />
myDoc.Load(myInStream);<br />
</code></p>
<p>Then make your changes to the XML in here - below is what I did, as an example</p>
<p><code><br />
XmlNode myRoot = myDoc.DocumentElement;<br />
XmlNamespaceManager xmlNSManager = new<br />
XmlNamespaceManager(myDoc.NameTable );<br />
xmlNSManager.AddNamespace("myNameSpace",<br />
"http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-08T14:13:41");<br />
XmlNode myColumnToAlter = myRoot.</code></p>
<p><code> SelectSingleNode("/myNameSpace:WFTaskForm/myNameSpace:myColumn", xmlNSManager);<br />
myColumnToAlter.InnerText = "This has been changed";<br />
</code></p>
<p>When you&#8217;ve finished changing your XML data, save the XmlDocument object back into SharePoint as a file.</p>
<p><code><br />
MemoryStream myOutStream = new MemoryStream();<br />
myDoc.Save(myOutStream);<br />
myFile.SaveBinary( myOutStream.ToArray());<br />
</code></p>
<p>Took me a ridiculous amount of time to figure all that out. It&#8217;s a good job that SharePoint makes it so easy&#8230;</p>
<p>Actually, I can see why they did it this way - but throwing an exception when I tried to write to the columns being read from the form would be useful. And maybe some instructions somewhere about how to do this. Still, maybe this will prove useful to someone&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/08/15/update-infopath-forms-from-within-workflow/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
