<?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>davedolan.com &#187; WSS3</title>
	<atom:link href="http://davedolan.com/blog/?feed=rss2&#038;tag=wss3" rel="self" type="application/rss+xml" />
	<link>http://davedolan.com/blog</link>
	<description>Website not included.</description>
	<lastBuildDate>Sun, 24 Jan 2010 05:46:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Custom SharePoint Workflow MetaData</title>
		<link>http://davedolan.com/blog/?p=91</link>
		<comments>http://davedolan.com/blog/?p=91#comments</comments>
		<pubDate>Fri, 31 Oct 2008 20:21:06 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET Coding]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[workflow]]></category>
		<category><![CDATA[WSS]]></category>
		<category><![CDATA[WSS3]]></category>

		<guid isPermaLink="false">http://davedolan.com/blog/?p=91</guid>
		<description><![CDATA[Have you ever wondered what VooDoo is going on in the &#8220;MetaData&#8221; element in the sharepoint workflow template definition (Workflow.xml)?  No? Well I have.
It&#8217;s not documented, but you can read it using the SharePoint Workflow API.  (The method you can call is documented, that is, listed, in the MSDN documentation. It&#8217;s not actually [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered what VooDoo is going on in the &#8220;MetaData&#8221; element in the sharepoint workflow template definition (Workflow.xml)?  No? Well I have.</p>
<p>It&#8217;s not documented, but you can read it using the SharePoint Workflow API.  (The method you can call is documented, that is, listed, in the MSDN documentation. It&#8217;s not actually explained, or as I would say it, &#8216;documented.&#8217;)</p>
<p>If you see our friend, the class <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowtemplate_members.aspx">SPWorkflowTemplate on MSDN</a>, you&#8217;ll notice that the Item property is there, but it&#8217;s not telling you that you basically just use that to pull the metadata. </p>
<p>So, from within a workflow template code block, how would you access this magical SPWorkflowTemplate?  There are a bunch of ways, but the simplest is to use the SPWorkflowProperties object that&#8217;s bound to your OnWorkflowActivated activity.</p>
<div class="code">
<code> <br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp; string GetMetaDataString(string valueName) {<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// get the template.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPWorkflowTemplate template = workflowProperties.Workflow.ParentAssociation.BaseTemplate;<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// WARNING: check the value for null before .ToString()<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// in C# there is only an indexer that aliases the .Item <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return template[valueName].ToString();<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;<br />
</code>
</div>
<p>Well what&#8217;s that good for? I&#8217;m not sure! That&#8217;s really up to you. I did see a couple of cool guys from the Ted Pattison Group using it to make a framework for doing effective workflow in WSS 3. (Here&#8217;s a link, it&#8217;s called <a href="http://codeplex.com/wss3workflow">WSS3Workflow</a>, and it&#8217;s great.)</p>
<p>I always end up putting things in the web.config, but some of the more static things I might never change, but technically want to be able to without recompiling the thing, might go in there.  I don&#8217;t know. I just thought it was cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://davedolan.com/blog/?feed=rss2&amp;p=91</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
