<?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>BinaryJam</title>
	<atom:link href="http://www.binaryjam.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binaryjam.com</link>
	<description>A place for Sharepoint and rantings</description>
	<lastBuildDate>Tue, 02 Mar 2010 16:46:50 +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>WSS3 &#8211; ItemAdded &#8211; deadlocked on lock</title>
		<link>http://www.binaryjam.com/2010/02/12/wss3-itemadded-deadlocked-on-lock/</link>
		<comments>http://www.binaryjam.com/2010/02/12/wss3-itemadded-deadlocked-on-lock/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 14:26:37 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=515</guid>
		<description><![CDATA[I&#8217;ve been having a problem with an app I wrote.  It works great, 99% of the time, but sometimes the ItemAdded event appears not to fire. Now this is using a list with over 20,000 entries in it and its growing all the time.  An associated list that references this list as a lookup has]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having a problem with an app I wrote.  It works great, 99% of the time, but sometimes the ItemAdded event appears not to fire.</p>
<p>Now this is using a list with over 20,000 entries in it and its growing all the time.  An associated list that references this list as a lookup has over 144,000 entries in it.</p>
<p>The event firing problem is becoming more frequent now as more users start using the system, there are at least 20 occurances in that 20,000 items, so it has to be fixed.</p>
<p>Managed to track down an error in the log</p>
<p style="padding-left: 30px;">System.Data.SqlClient.SqlException: Transaction (Process ID 61) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.</p>
<p>It&#8217;s stack trace was similar too this (I cut it down a bit and changed some names, my naming is not this bad)</p>
<p style="padding-left: 30px;">at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()<br />
   at Microsoft.SharePoint.SPListItemCollection.get_Item(Guid uniqueId)<br />
   at BinaryJam.Core.Code.TicketListReceiver.ItemReceiver.ItemAddedActual(Guid SiteId, Guid ListItemId, String UserDisplayName)<br />
   at BinaryJam.Core.Code.TicketListReceiver.ItemReceiver.&lt;&gt;c__DisplayClass11.&lt;ItemAdded&gt;b__e()<br />
   at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)<br />
   at Microsoft.SharePoint.SPSecurity.&lt;&gt;c__DisplayClass4.&lt;RunWithElevatedPrivileges&gt;b__2()<br />
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)<br />
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)<br />
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)<br />
   at BinaryJam.Core.Code.ItemListReceiver.ItemReceiver.ItemAdded(SPItemEventProperties properties)</p>
<p>So as you can see, it explodes on the GetItem.</p>
<p>This was my stupid mistake, a mistake I bet many of you are making every day.</p>
<p style="PADDING-LEFT: 30px">SPListItem item = List.Items[listItemId];</p>
<p>This I believe is the primary cause of the problem as this statement loads the complete List before returning the specific item I needed and as this list grows, remember 20,000 items already, its going to get worse.  Now for most of you this won&#8217;t be a problem as you will be just getting the ListItem from the parameters, in my case I have to run as elevated as Im doing lots of stuff with Security Groups, that the entering user may not be in, hence my needing to re-get the List Item in the right security context.</p>
<p>So if your having a problem like this remember, Always use the</p>
<p style="PADDING-LEFT: 30px">List.GetItemByID(id); //Or<br />
List.GetItemByUniqueId(guid);</p>
<p>This may or may not solve my problem I believe it will, if it doesn&#8217;t it&#8217;s still going to improve the performance of my application.  If your wondering, this is the only time I use this and don&#8217;t know why I did, the rest of the App uses getby id or SPQueries.</p>
<p>A Good Article on Performance I did actually read, hence the app performs pretty well, except for this one bug, which is now hopefully fixed.</p>
<div><a href="http://technet.microsoft.com/en-us/library/cc262813.aspx" target="_blank">White paper: Working with large lists in Office SharePoint Server 2007</a><!----></div>
<p style="PADDING-LEFT: 30px"><a href="http://msdn.microsoft.com/en-us/library/bb687949.aspx"></a> </p>
<p> </p>
<p> </p>
<p style="PADDING-LEFT: 30px"> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2010/02/12/wss3-itemadded-deadlocked-on-lock/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WSS Problem with Provisioning</title>
		<link>http://www.binaryjam.com/2009/11/24/wss-problem-with-provisioning/</link>
		<comments>http://www.binaryjam.com/2009/11/24/wss-problem-with-provisioning/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 15:05:24 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[moss]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[wss]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/11/24/wss-problem-with-provisioning/</guid>
		<description><![CDATA[Been having a problem with SiteProvisioningProvider. Well I haven&#8217;t but apparently it causes problems down the line if things are not done in a specific order. A nice man at microsoft diagnosed the problem and came up with the code you should run to ensure your not messing up the Web. Here is a posting]]></description>
			<content:encoded><![CDATA[<p>Been having a problem with SiteProvisioningProvider.  Well I haven&#8217;t but apparently it causes problems down the line if things are not done in a specific order.</p>
<p>A nice man at microsoft diagnosed the problem and came up with the code you should run to ensure your not messing up the Web.</p>
<p>Here is a posting of the proposed solution to the bug we found (I don&#8217;t care if they don&#8217;t think its a bug, not sure if they do or don&#8217;t but I do!)</p>
<p>http://blogs.msdn.com/joerg_sinemus/archive/2009/11/24/overwriting-spwebprovisioningprovider-provision.aspx</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/11/24/wss-problem-with-provisioning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WSS, Workflow, Who Actually approved this ?</title>
		<link>http://www.binaryjam.com/2009/11/05/wss-workflow-who-actually-approved-this/</link>
		<comments>http://www.binaryjam.com/2009/11/05/wss-workflow-who-actually-approved-this/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 09:36:53 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=510</guid>
		<description><![CDATA[So I like many have a workflow that takes requests for Sites with a bunch of details for costing etc.  Then when approved those Sites are created and permissions allocated. What we did not have was a record of who actually approved the sites.  Whilst this info is in the workflow history after a while]]></description>
			<content:encoded><![CDATA[<p>So I like many have a workflow that takes requests for Sites with a bunch of details for costing etc.  Then when approved those Sites are created and permissions allocated.</p>
<p>What we did not have was a record of who actually approved the sites.  Whilst this info is in the workflow history after a while that information gets purged, leaving us with Sites that were approved but by whom we know not.</p>
<p>So this is a simple case of changing the workflow and recording all of the approvers in the SPWeb properties, except that the approvers as we can tell happen to be Sharepoint Groups or AD groups, neither of which contain a history of membership, if AD does none I know how to access and certainly not easy for the customer and in a large membership we still would not know who actually did the deed.</p>
<p>I dug and dug for this and eventually found the User Login that actually did the change and here is how.</p>
<p>In your workflow you need a &#8220;Workflow Action&#8221; of EventName &#8220;OnTaskChanged&#8221;, this object in the code behind, when Invoked contains AfterProperties,</p>
<p style="PADDING-LEFT: 30px">string user = OnApprovalTaskChanged.AfterProperties.ExtendedProperties[new Guid("d31655d1-1d5b-4511-95a1-7a09e9b75bf2")].ToString();</p>
<p><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #000000;">The above statement gets the User Login frmo the ExtendedProperties Collection.  It Stores the User under the key of that Guid in a User type field that refers to the Editor.</span></span></span></p>
<p><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #000000;">A list of fields can be found <a href="http://johnholliday.net/downloads/fieldswss.htm">here </a>.</span></span></span></p>
<p><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #000000;">So that&#8217;s it, took a lot of debugging and poking about but next time your looking for the actual approving user, take a look here.</span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/11/05/wss-workflow-who-actually-approved-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharepoint and ResX and a little tool</title>
		<link>http://www.binaryjam.com/2009/10/14/sharepoint-and-resx-and-a-little-tool/</link>
		<comments>http://www.binaryjam.com/2009/10/14/sharepoint-and-resx-and-a-little-tool/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 10:42:19 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[globalisation]]></category>
		<category><![CDATA[localisation]]></category>
		<category><![CDATA[resx]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=506</guid>
		<description><![CDATA[I am doing lots of work in Sharepoint that requires resource files in english and german. With a variety of developers before me different styles of editing the foreign language files emerged. I think that much better tool support for managing resx&#8217;s is required,  and I recently found one that is a great help to]]></description>
			<content:encoded><![CDATA[<p>I am doing lots of work in Sharepoint that requires resource files in english and german.</p>
<p>With a variety of developers before me different styles of editing the foreign language files emerged.</p>
<p>I think that much better tool support for managing resx&#8217;s is required,  and I recently found one that is a great help to us with a vareity of resx&#8217;s in various states of translation and existence.</p>
<p><a href="http://resxtranslator.codeplex.com/">http://resxtranslator.codeplex.com/</a></p>
<p>This resx tool allows you to pick a file and it displays the nuetral and foreign side by side along with comments and allows you to edit them all at once.  Corking piece of work, some polish would go amiss but Im hard pushed to say where as it does exactly what I need it to do and I can pass it to a non-techie developer.  It still down to me to edit the comments first to identify what needs translating and what definately needs leaving alone.</p>
<p>If you doing multi-language work go and check this tool out it might just help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/10/14/sharepoint-and-resx-and-a-little-tool/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WSS and PowerShell 2</title>
		<link>http://www.binaryjam.com/2009/07/31/wss-and-powershell-2/</link>
		<comments>http://www.binaryjam.com/2009/07/31/wss-and-powershell-2/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 09:41:23 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/31/wss-and-powershell-2/</guid>
		<description><![CDATA[If you were one of the two people who read my last post on WSS and PowerShell I updated it a bit and it&#8217;s worth checking out the changes. I thought this time I would just point out some of the very simple statements in PowerShell that differ from your usual C# so that you]]></description>
			<content:encoded><![CDATA[<p>If you were one of the two people who read my last post on WSS and PowerShell I updated it a bit and it&#8217;s worth checking out the changes.</p>
<p>I thought this time I would just point out some of the very simple statements in PowerShell that differ from your usual C# so that you can quickly make a transition from one to another.</p>
<p>One of the first things any programmer might need to do in a script is conditions so here is a PowerShell condition and how it differs to c#</p>
<blockquote><pre class="code"><span style="color: blue">if </span><span style="color: black">(</span><span style="color: purple">$i </span><span style="color: red">-eq </span><span style="color: black">10)
{
    </span><span style="color: #5f9ea0">write </span><span style="color: maroon">&quot;It's ten you know&quot;
</span><span style="color: black">}</span></pre>
</blockquote>
<p><span style="color: black">The comparison operator for equals is not &quot;=&quot; or &quot;==&quot; but a scripting style operator of -eq. So this is the </span><span style="color: black">first thing you&#8217;re going to have to remember.&#160; Other operators are</span></p>
<blockquote>
<p><span style="color: black">-gt greater than,&#160; -lt less than,&#160; -ge greater than or equal to,&#160; -ne not equal</span></p>
<p>  <span style="color: black"></span></p></blockquote>
<p><span style="color: black"></span><span style="color: black">There are more I found a simple table of them <a href="http://www.computerperformance.co.uk/powershell/powershell_syntax.htm#Operators_">here</a>.</span></p>
<p><span style="color: black">When dealing with boolean responses its important to know that they are represented by $true and $false so a condition to test this would look like</span></p>
<blockquote>
<p><span style="color: black"><span style="color: blue">if </span><span style="color: black">(</span><span style="color: purple">$kidding </span><span style="color: red">-eq </span><span style="color: blue">$false</span><span style="color: black">)<br />
        <br />{ </p>
<p>&#160;&#160;&#160; </span><span style="color: #5f9ea0">write </span><span style="color: maroon">&quot;How strange&quot;<br />
        <br /></span><span style="color: black">}</span></span></p>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<p>Now being good little programmers you&#8217;re bound to want to structure your scripts, so functions!&#160; PowerShell has functions, but remember this is not a compiled language but a scripting language, this means you have to declare your functions before you can call them, this is not VBScript where you could have your main at the top and functions below, your execution code starts at the bottom after you declared your functions.&#160; </p>
<p>So declaring a function can be as simple as (there are other ways but I&#8217;m sticking with this one for now)</p>
<blockquote>
<pre class="code"><span style="color: blue">function </span><span style="color: #5f9ea0">GoGetMyList</span><span style="color: black">(</span><span style="color: purple">$name</span><span style="color: black">)
{
    </span><span style="color: purple">$list</span><span style="color: red">=</span><span style="color: purple">$lists</span><span style="color: black">[</span><span style="color: maroon">&quot;MyList&quot;</span><span style="color: black">]
    </span><span style="color: blue">return </span><span style="color: purple">$list
</span><span style="color: black">}</span></pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<p>The function has a parameter of $name and returns $list.&#160; Now the observant of you will have noticed that I created my $list on the fly giving it a scope of function level, but I access $lists whose scope is outside of the function, ok bad coding perhaps, but it&#8217;s to prove a point.</p>
<p>Variable scopes.&#160; There are I believe three scopes&#160; Global, Script, Stack (function) level. </p>
<blockquote>
<p><strong>Global scope</strong> is used in the PowerShell environment mostly you can set something of Global level in a script and it will be available on completion of the script in the scripting &quot;Shell/Command Prompt&quot; environment, if you are chaining scripts together this could be useful.</p>
<p><strong>Script scope</strong>.&#160; This is like a global or module level variable to your script code, once declared it&#8217;s accessible inside and outside all your functions</p>
<p><strong>Stack/Function scope</strong>.&#160;&#160; Declare a variable inside a function it&#8217;s scope and life-span are inside that function.</p>
</blockquote>
<blockquote></blockquote>
<p><span style="color: black"></p>
<p>The weird thing is how you declare and reference these variables.&#160; So here is how to define 3 scopes within a function</p>
<blockquote>
<pre class="code"><span style="color: blue">function </span><span style="color: #5f9ea0">GetBaseObjects</span><span style="color: black">(</span><span style="color: purple">$SiteUrl</span><span style="color: black">)
{

    </span><span style="color: purple">$script:site </span><span style="color: red">= </span><span style="color: #5f9ea0">New-Object </span><span style="color: maroon">Microsoft.SharePoint.SPSite </span><span style="color: purple">$SiteUrl
    $script:web </span><span style="color: red">= </span><span style="color: purple">$site</span><span style="color: black">.RootWeb
    </span><span style="color: purple">$script:lists</span><span style="color: red">=</span><span style="color: purple">$web</span><span style="color: black">.Lists
    </span><span style="color: purple">$script:list</span><span style="color: red">=</span><span style="color: purple">$lists</span><span style="color: black">[</span><span style="color: maroon">&quot;MyList&quot;</span><span style="color: black">]
    </span><span style="color: purple">$item</span><span style="color: red">=</span><span style="color: purple">$list</span><span style="color: black">.GetItemById(1)
    </span><span style="color: purple">$Global:DispName</span><span style="color: red">=</span><span style="color: purple">$item</span><span style="color: black">.</span><span style="color: #8b4513">DisplayName
    </span><span style="color: blue">return </span><span style="color: purple">$item
</span><span style="color: black">}</span></pre>
</blockquote>
<p>  <a href="http://11011.net/software/vspaste"></a></p>
<p>Now this is a thoroughly useless function but it demonstrates the differing levels.</p>
<blockquote>
<p><span style="color: purple">$script:site </span><span style="color: red">= </span><span style="color: #5f9ea0">New-Object </span><span style="color: maroon">Microsoft.SharePoint.SPSite </span><span style="color: purple">$SiteUrl</span></p>
</blockquote>
<p>The $scipt:site&#160; declares the variable at a script level accessible from another function or the script &quot;main body&quot;, there is no need to pre-declare these variables because at EVERY assignment you make it sets the scope, this is a valid set of statements</p>
<blockquote>
<pre class="code"><span style="color: blue">function </span><span style="color: #5f9ea0">dave</span><span style="color: black">()
{
    </span><span style="color: purple">$script:tellme</span><span style="color: red">=</span><span style="color: maroon">&quot;Script&quot;
    </span><span style="color: #5f9ea0">write </span><span style="color: purple">$tellme
    $tellme</span><span style="color: red">=</span><span style="color: maroon">&quot;function&quot;
    </span><span style="color: #5f9ea0">write </span><span style="color: purple">$tellme
</span><span style="color: black">}
</span><span style="color: #5f9ea0">dave
write </span><span style="color: purple">$tellme</span></pre>
<p>    <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<p>  <a href="http://11011.net/software/vspaste"></a></p>
<p>This will display &quot;Script&quot;, &quot;function&quot; and &quot;Script&quot;.&#160; This is because PowerShell with search each scope for a variable and if not there it looks up the inherited variable scope tree, for want of better words.&#160; The first time referenced we have a script level but the second time we have a function level and the third time the function itself is out of scope along with its variables so we access the script level one again.</p>
<p>So remember the order of your functions when setting scope level variables and ALWAYS when setting a variable to define the scope.</p>
<p>That&#8217;s all for this post, I&#8217;ll try and do another one encompassing error handling and arguments in a complete script that changes SharePoint settings.</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:3aa81613-123a-4312-aa93-02a6b4e2f8ef" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/Sharepoint" rel="tag">Sharepoint</a>,<a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/moss" rel="tag">moss</a>,<a href="http://technorati.com/tags/powershell" rel="tag">powershell</a></div>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/31/wss-and-powershell-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WSS3 Event Receivers</title>
		<link>http://www.binaryjam.com/2009/07/23/wss3-event-receivers/</link>
		<comments>http://www.binaryjam.com/2009/07/23/wss3-event-receivers/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 12:34:13 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/23/wss3-event-receivers/</guid>
		<description><![CDATA[I&#8217;ve been doing some work with List Item Event Receivers and thought I&#8217;d share my experiences. First there are a bunch of events that can be raised, I won&#8217;t list all but here are some of the good ones ItemAdding /&#160; ItemAddedItemUpdating / ItemUpdated There are also specific ways of dealing with the data in]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some work with List Item Event Receivers and thought I&#8217;d share my experiences.</p>
<p>First there are a bunch of events that can be raised, I won&#8217;t list all but here are some of the good ones</p>
<blockquote><p>ItemAdding /&nbsp; ItemAdded<br />ItemUpdating / ItemUpdated</p>
</blockquote>
<p>There are also specific ways of dealing with the data in each of these events, those that are &#8220;ing&#8221; events then the changes have not been applied yet so you get the change values from the AfterProperties passed in, those ending in &#8220;ed&#8221; you can grab the List Item directly as changes have already happened.</p>
<p>My experiences have been problematic so here is a few points that may help you when using these events.</p>
<h2>Attachments</h2>
<p>If you want to get hold of the attachments being added to a List, you can&#8217;t. (This may differ for doc libraries I have not inspected this).&nbsp; Attachments are not on the list item as it does not exist yet and they are not in the Properties either.&nbsp; Anything you want to do regarding attachments you have to do in &#8220;ed&#8221; events.</p>
<h2>ID&#8217;s</h2>
<p>When in the &#8220;Adding&#8221; event the one thing you have not got is the List.ID value.&nbsp; If you were hoping to create entries in another list that has a lookup field of this list, your out of luck. There is no ID available to you, neither is there an @@IDENTITY equivalent.</p>
<h2>Synchronous/Asynchronous Calls</h2>
<p>The different types of events run in different contexts. In an Adding event this runs in the context of the Add from the page itself, after hitting Add in NewForm.aspx it will execute this Adding event code under the w3wp.exe process.&nbsp; This is very handy when debugging as you can attach to the w3wp process and just debug.</p>
<p>**<strike>I have found that Added/Updated events are not called like this they are executed, I believe, I can&#8217;t be sure, by OWSTIMER, but regardless of the process</strike>, they are not executed immediately after the Adding events.&nbsp; <strike>This can be witnessed by debugging the process and placing a breakpoint on the first line of Added code, After you hit &#8220;Add&#8221; the page refreshes and shows the list, however your breakpoint code is still waiting so this is on another thread of execution to your Adding code.</strike></p>
<blockquote><p><em>**Absolute nonsense.&nbsp; The Added events also fire on the w3wp process but they do fire on a separate thread.&nbsp; I have had problems in the past where the Added/Updated events do not stop on my breakpoints but it is not because they happen in the timer service, it&#8217;s some other reason.&nbsp; I tried it just and it breaks on both adding and added.</em></p>
</blockquote>
<p>This sounds like no big deal, in my example I needed to format the Title field to be the ID + &#8220;Mask&#8221;.&nbsp; I did not have access to the ID until Added event.&nbsp; After adding the list item the list view would re-appear with a blank title.&nbsp; This was unacceptable to the client so I had to populate the field with some text &#8220;to be assigned&#8221;.&nbsp; Later the Adding event kicks in has access to the ID and sets the Title to the Masked value I need.&nbsp; The users on refresh of the list got what they wanted.</p>
<p>I know its a fudge, but you can&#8217;t do it in the event you cant use calculated fields or any of those tools this is what I had, but it&#8217;s worth knowing your &#8220;ed&#8221; events happen on a separate thread.</p>
<h2>Enable/DisableFiring</h2>
<p>In the &#8220;ing&#8221; events above, your receiver may need to alter the data, However you will be altering the data on the List.&nbsp; If in the Adding event you set a field and update the list item then it will call the Updating/Updated events.&nbsp; This is not normally what you want to happen as you might get into an endless update loop.</p>
<p>For this very purpose the SPItemEventReceiver Class you inherited can turn off this event firing. So in your event handler you can execute</p>
<blockquote><p><span style="color: blue">this</span>.DisableEventFiring();</p>
</blockquote>
<p>This will stop all further event firing, now here&#8217;s the rub AT LIST LEVEL, NOT LIST ITEM. So if you have a high usage list and add two at the same time, you may find you turn off eventing in one add to prevent the other list item executing the event receiver at all.&nbsp; Now you say that will never happen but in my previous example the &#8220;ed&#8221; event was not firing and I was left with &#8220;to be assigned&#8221; items that never sent notifications, modified their item level security etc because of this.</p>
<blockquote><pre class="code"><span style="color: blue">this</span>.DisableEventFiring();
listItem.Update();
<span style="color: blue">this</span>.EnableEventFiring();</pre>
</blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Really BIG HINT, always turn it back on again immediately.</p>
<h2>Exception Handling</h2>
<p>If you have code that MUST execute, like setting security, and other code that must also execute but if it broke you can live with it then organise the order of execution and consider multiple update() calls.&nbsp; This is not a transaction, you have no rollback if your event fails, you just have a fail. This is also not exactly efficient either.</p>
<p>Consider the example where you set item level security based on a fields value, then emailing the customer or whoever.</p>
<p>Normally you might</p>
<blockquote><pre class="code"><span style="color: #2b91af">SPSecurity</span>.RunWithElevatedPrivileges(<span style="color: blue">delegate</span>() { ItemAddedElevated(properties.ListItem); });</pre>
<p></p>
<pre class="code">private void ItemAddedElevated(SPListItem ListItem){</pre>
</blockquote>
<blockquote><pre class="code"><span style="color: blue">    this</span>.DisableEventFiring();    SendEmails(ListItem);

    SetSecurity(ListItem);    ListItem[<span style="color: #a31515">"Sent"</span>] = "Yes";    <span style="color: blue">this</span>.EnableEventFiring();</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
</blockquote>
<p>}</p>
<p>Obviously Bad Code. No exception handling, email servers go wrong, the SMTP format may not have been validated causing exceptions in the Sendmail bit, this will error, write to the log and never be heard of again, meanwhile you have bad security in your application. Also look at all that code being executed with events turned off, and what happens if an exception occurs before event firing is turned on, I don&#8217;t know, might not be good though.</p>
<p>Rewrite this code</p>
<blockquote><pre class="code"><span style="color: #2b91af">SPSecurity</span>.RunWithElevatedPrivileges(<span style="color: blue">delegate</span>() { ItemAddedElevated(properties.ListItem); });</pre>
<p></p>
<pre class="code">private void ItemAddedElevated(SPListItem ListItem){</pre>
</blockquote>
<blockquote><pre class="code">    SetSecurity(ListItem);
    ListItem[<span style="color: #a31515">"Sent"</span>] = "Yes";
    <span style="color: blue">this.DisableEventFiring();
</span>    ListItem.Update();    

    <span style="color: blue">this</span>.EnableEventFiring();</pre>
<p></p>
<pre class="code">    SendEmails(ListItem)</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
</blockquote>
<p>}</p>
<p>This slight change is less likely to go wrong but it&#8217;s still not brilliant is it, a bunch of try catch finally&#8217;s would be good here, but I&#8217;ll let you figure that out.</p>
<p>That&#8217;s all I can think of for now.</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bb9ca618-d364-4893-987f-15fea059ea1c" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a>,<a href="http://technorati.com/tags/moss" rel="tag">moss</a>,<a href="http://technorati.com/tags/event%20receivers" rel="tag">event receivers</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/23/wss3-event-receivers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WSS and PowerShell</title>
		<link>http://www.binaryjam.com/2009/07/23/wss-and-powershell/</link>
		<comments>http://www.binaryjam.com/2009/07/23/wss-and-powershell/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 08:50:59 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/23/wss-and-powershell/</guid>
		<description><![CDATA[The more I do with SharePoint the more and more I an finding a use for PowerShell. I am using WSS as an application platform and using lists etc as a datasource.&#160; Providing what you want is not huge amounts of referential integrity and transactional control etc it works pretty well. But when things go]]></description>
			<content:encoded><![CDATA[<p>The more I do with SharePoint the more and more I an finding a use for PowerShell. I am using WSS as an application platform and using lists etc as a datasource.&#160; Providing what you want is not huge amounts of referential integrity and transactional control etc it works pretty well. </p>
<p>But when things go wrong, often the only way to quickly get in a fix something in a structured, repeatable and documented manner is PowerShell.&#160; Hell and its fun too.</p>
<p>So as a Sharepointy person what do you need to learn to get you quickly started.</p>
<p>First go and <a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx">install PowerShell</a>, this is version 1 which is what I am using, version 2 will be great but is not in production yet, so try getting that on your live servers, if they let you, sack them &#8211; pre-release code on production servers pah!.</p>
<p>Next go and download Quest&#8217;s <a href="http://powergui.org">PowerGUI</a>.&#160; This comes with the fantastic script editor, that allows stepping through code and debugging, i tend to use this for all my PowerShell development, I&#8217;m used to Visual Studio so being confronted with a command shell environment can be a little daunting.</p>
<p>Now if you go looking on the web at powershell there are some great resources and experts, I am not one of them I barely know PowerShell at all, I just rely on some simple things to get it working with SharePoint. </p>
<p>The biggest thing about PowerShell is you can just create .NET objects in it.&#160; Yep just go ahead and create an SPSite object and away you go. </p>
<p>So lets dive into an example straight away</p>
<blockquote><pre class="code"><span style="color: black">[</span><span style="color: teal">void</span><span style="color: black">][</span><span style="color: teal">System.Reflection.Assembly</span><span style="color: black">]::</span><span style="color: #8b4513">LoadWithPartialName</span><span style="color: black">(</span><span style="color: maroon">&quot;Microsoft.SharePoint&quot;</span><span style="color: black">)

</span><span style="color: purple">$site </span><span style="color: red">= </span><span style="color: #5f9ea0">New-Object </span><span style="color: maroon">Microsoft.SharePoint.SPSite &quot;http://localhost/products/MyWSSApp&quot;
</span><span style="color: purple">$web </span><span style="color: red">= </span><span style="color: purple">$site</span><span style="color: black">.RootWeb
</span><span style="color: purple">$lists</span><span style="color: red">=</span><span style="color: purple">$web</span><span style="color: black">.Lists

</span><span style="color: purple">$list</span><span style="color: red">=</span><span style="color: purple">$lists</span><span style="color: black">[</span><span style="color: maroon">&quot;MyList&quot;</span><span style="color: black">]

</span><span style="color: purple">$item</span><span style="color: red">=</span><span style="color: purple">$list</span><span style="color: black">.GetItemById(1)

</span><span style="color: purple">$item</span><span style="color: black">[</span><span style="color: maroon">&quot;Title&quot;</span><span style="color: black">]</span><span style="color: red">=</span><span style="color: maroon">&quot;Jeff&quot;
</span><span style="color: purple">$item</span><span style="color: black">.Update()
</span><span style="color: purple">$item</span><span style="color: red">=</span><span style="color: purple">$null </span><span style="color: purple">$list</span><span style="color: red">=</span><span style="color: purple">$null
$lists</span><span style="color: red">=</span><span style="color: purple">$null
$web</span><span style="color: red">=</span><span style="color: purple">$null
$site</span><span style="color: black">.Dispose()
</span><span style="color: purple">$site</span><span style="color: red">=</span><span style="color: purple">$null</span></pre>
</blockquote>
<p>&#160;</p>
<p>This code will be executed on a machine with WSS installed on it, you can&#8217;t remote it from a box without PS and WSS installed. It&#8217;s LOCAL.</p>
<p>The first thing we do is load the assembly, without which PS knows nothing of the objects.&#160; </p>
<blockquote>
<p><span style="color: black">[</span><span style="color: teal">void</span><span style="color: black">][</span><span style="color: teal">System.Reflection.Assembly</span><span style="color: black">]::</span><span style="color: #8b4513">LoadWithPartialName</span><span style="color: black">(</span><span style="color: maroon">&quot;Microsoft.SharePoint&quot;</span><span style="color: black">) </span></p>
</blockquote>
<p>the next thing I&#8217;m doing is to create a reference to my site collection</p>
<blockquote>
<p><span style="color: purple">$site </span><span style="color: red">= </span><span style="color: #5f9ea0">New-Object </span><span style="color: maroon">Microsoft.SharePoint.SPSite &quot;<a href="http://localhost/products/MyWSSApp">http://localhost/products/MyWSSApp</a>&quot;</span></p>
</blockquote>
<p>The <span style="color: maroon"><span style="color: #5f9ea0">New-Object </span></span>statement is PowerShell&#8217;s way of creating a .NET object, the C# equivalent would be</p>
<blockquote>
<p><span style="color: #2b91af">SPSite </span>site = <span style="color: blue">new </span><span style="color: #2b91af">SPSite</span>(<a href="http://localhost/products/MyWSSApp">http://localhost/products/MyWSSApp</a>)</p>
</blockquote>
<p>There is no need to declare the type in PowerShell, although it is possible to cast types, which you will need later on in your Scripting, but not today.</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>All variables in PowerShell are prefixed with a $ sign. </p>
<p>In the next sequence of statement you can see I easily manipulate the .NET Sharepoint object model from within PowerShell.&#160; I can grab the RootWeb and assign it to a new PowerSHell variable and likewise with the list and a list Item.&#160; Then a simple data change and list update.&#160; All things you will be used to doing in C# can be done easily ni PowerShell to.</p>
<blockquote>
<p><span style="color: purple">$web </span><span style="color: red">= </span><span style="color: purple">$site</span><span style="color: black">.RootWeb<br />
      <br /></span><span style="color: purple">$lists</span><span style="color: red">=</span><span style="color: purple">$web</span><span style="color: black">.Lists<br />
      <br /></span><span style="color: purple">$list</span><span style="color: red">=</span><span style="color: purple">$lists</span><span style="color: black">[</span><span style="color: maroon">&quot;MyList&quot;</span><span style="color: black">]<br />
      <br /></span><span style="color: purple">$item</span><span style="color: red">=</span><span style="color: purple">$list</span><span style="color: black">.GetItemById(1)<br />
      <br /></span><span style="color: purple">$item</span><span style="color: black">[</span><span style="color: maroon">&quot;Title&quot;</span><span style="color: black">]</span><span style="color: red">=</span><span style="color: maroon">&quot;Jeff&quot; </span><span style="color: purple">$item</span><span style="color: black">.Update() </span></p>
</blockquote>
<p>Notice that I still deliberately DISPOSE of the site, this is still important to do even in powerShell.</p>
<p><div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6831b81e-06f6-41c3-a9df-e8d8959460ed" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/powershell" rel="tag">powershell</a>,<a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/23/wss-and-powershell/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WSS 3 &#8211; Site Provisioning / List Security</title>
		<link>http://www.binaryjam.com/2009/07/13/wss-3-site-provisioning-list-security/</link>
		<comments>http://www.binaryjam.com/2009/07/13/wss-3-site-provisioning-list-security/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 15:01:18 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/13/wss-3-site-provisioning-list-security/</guid>
		<description><![CDATA[I&#8217;ve been having some more fun with Site Provisioning.&#160; I have a requirement that in my Prov code I need to alter groups.&#160; For most of my work I&#8217;ve been altering RoleAssignments in SPWebs with no trouble, however I came to do the same with a list as in an SPWeb. Now I&#8217;m not sure]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having some more fun with Site Provisioning.&#160; I have a requirement that in my Prov code I need to alter groups.&#160; For most of my work I&#8217;ve been altering RoleAssignments in SPWebs with no trouble, however I came to do the same with a list as in an SPWeb.</p>
<p>Now I&#8217;m not sure if you can do security in the ONET but for my requirements I have $Resources that need concatenating together to form the group names (don&#8217;t ask).&#160; Which it can&#8217;t do so it has to be done as a site provisioning thing.</p>
<p>What I noticed though is in my list, &quot;of parent SPWEb of Parent SPWeb(RootWeb)&quot; things where not as they were supposed to be.</p>
<p>The security on the list was completely wrong, as in it stated it had Unique permissions, when actually it does not, it will have when I&#8217;m finished with it, but at Site Provisioning time it should not.&#160; Also all the groups were relating to the Site Collection level not the custom groups of the sub site it should have inherited.</p>
<p>It&#8217;s as if none of the list processing for fixing up the security on the list has happened, as it had done previously on SPWeb objects.</p>
<p>After Large amounts of digging I found that at time of Site Provisioning the List.Update() method has not been called. Calling this on the list before I do my processing, resolves all security issues.</p>
<p>So if having trouble provisioning list security remember the lists still in flux till you call the Update, whereas the SPWeb objects are not.&#160; Weird, but true.</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bd522fb2-7c4b-4424-bf30-c9be2f654f3e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/moss" rel="tag">moss</a>,<a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/13/wss-3-site-provisioning-list-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WSS &#8211; ONET</title>
		<link>http://www.binaryjam.com/2009/07/08/wss-onet/</link>
		<comments>http://www.binaryjam.com/2009/07/08/wss-onet/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 13:32:43 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/08/wss-onet/</guid>
		<description><![CDATA[Whilst messing with a product some contractor of ours did for us (SURJIT I&#8217;m talking about you).&#160; I discovered a lovely piece of code. The SiteDef had some SiteProvisioning code, it read an XML file to do additional processes as part of the site provisioning, rather handy in some cases. But I did notice a]]></description>
			<content:encoded><![CDATA[<p>Whilst messing with a product some contractor of ours did for us (SURJIT I&#8217;m talking about you).&#160; I discovered a lovely piece of code.</p>
<p>The SiteDef had some SiteProvisioning code, it read an XML file to do additional processes as part of the site provisioning, rather handy in some cases.</p>
<p>But I did notice a few oddities.</p>
<p>In SiteProv he was creating lists.&#160; Also He was copying files from the file system into Lists.&#160; Some users just don&#8217;t have access to this part of the file system and this was exploding.</p>
<p>Two things about this technique, </p>
<ul>
<li>1st. You can Provision Lists in the ONET. </li>
<li>2nd You can copy files into lists in the ONET. </li>
</ul>
<p>The first item he should have known, so WHY do it as part of site provisioning event ?&#160; I don&#8217;t know. Perhaps something to do with sequence, perhaps stupidity <img src='http://www.binaryjam.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>Second I can forgive, someone not trained in SharePoint might not know exactly what the &lt;Module&gt; Tag is really for.</p>
<p>Think of the &lt;Module&gt; tag in Features and SiteDefs as a kind of File copy as well as configuring what webparts go where on a page, it can copy files from the file system into a DocLibrary, but most importantly it has the correct rights to do it.</p>
<p>Some extra info on ONET&#8217;s and Modules.</p>
<p>From all the examples you have seen in existing SiteDefs the most likely arrangement would be something like this </p>
<p> <span id="more-488"></span>
<p>&#160;<span class="kwrd">&lt;</span><span class="html">Project</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Configurations</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Configuration</span> <span class="attr">ID</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">Name</span><span class="kwrd">=&quot;Default&quot;</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Lists</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">List</span> <span class="attr">FeatureId</span><span class="kwrd">=&quot;00BFEA71-E717-4E80-AA17-D0C71B360101&quot;</span> <span class="attr">Type</span><span class="kwrd">=&quot;101&quot;</span> <span class="attr">Title</span><span class="kwrd">=&quot;MyPlaceForFiles&quot;</span> <span class="attr">Url</span><span class="kwrd">=&quot;MyPlaceForFiles&quot;</span><span class="kwrd">/&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Lists</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Modules</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Module</span> <span class="attr">Name</span><span class="kwrd">=&quot;Default&quot;</span> <span class="kwrd">/&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Modules</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Configuration</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Configurations</span><span class="kwrd">&gt;</span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Modules</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">Module</span> <span class="attr">Name</span><span class="kwrd">=&quot;Default&quot;</span> <span class="attr">Url</span><span class="kwrd">=&quot;&quot;</span> <span class="attr">Path</span><span class="kwrd">=&quot;&quot;</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">File</span> <span class="attr">Url</span><span class="kwrd">=&quot;default.aspx&quot;</span> <span class="attr">NavBarHome</span><span class="kwrd">=&quot;True&quot;</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;</span><span class="html">AllUsersWebPart</span> <span class="attr">WebPartZoneID</span><span class="kwrd">=&quot;LeftZone1&quot;</span> <span class="attr">WebPartOrder</span><span class="kwrd">=&quot;0&quot;</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;!</span>[CDATA[.....WebPart Stuff.......]]<span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">AllUsersWebPart&#8211;</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">File</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Module</span><span class="kwrd">&gt;</span>    <br />&#160;&#160;&#160; <span class="kwrd">&lt;/</span><span class="html">Modules</span><span class="kwrd">&gt;</span>    <br /><span class="kwrd">&lt;/</span><span class="html">Project</span><span class="kwrd">&gt;</span></p>
<p>So in the example I mentioned where I want to copy a file from my SiteDef into a List would go something&#160; </p>
<p>&lt;Project&gt;   <br />&#160;&#160;&#160; &lt;Configurations&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Configuration ID=&quot;0&quot; Name=&quot;Default&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Lists&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;List FeatureId=&quot;00BFEA71-E717-4E80-AA17-D0C71B360101&quot; Type=&quot;101&quot; Title=&quot;MyListForFiles&quot; Url=&quot;MyPlaceForFiles&quot;/&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Lists&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Modules&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Module Name=&quot;Default&quot; /&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Module Name=&quot;WhatASecondModule&quot; /&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Modules&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Configuration&gt;    <br />&#160;&#160;&#160; &lt;/Configurations&gt;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &lt;Modules&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Module Name=&quot;Default&quot; Url=&quot;&quot; Path=&quot;&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;File Url=&quot;default.aspx&quot; NavBarHome=&quot;True&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;AllUsersWebPart WebPartZoneID=&quot;LeftZone1&quot; WebPartOrder=&quot;0&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;![CDATA[.....WebPart Stuff.......]]&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/AllUsersWebPart&#8211;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/File&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Module&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;Module Name=&quot;WhatASecondModule&quot; Url=&quot;MyListForFiles&quot; Path=&quot;FolderItCameFromOnDiskInSiteDef&quot; RootWebOnly=&quot;FALSE&quot;&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;File Url=&quot;SourceFileIWantToChangeOnFlyInDocLib.js&quot; IgnoreIfAlreadyExists=&quot;TRUE&quot; Type=&quot;GhostableInLibrary&quot;/&gt;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/Module&gt;    <br />&#160;&#160;&#160; &lt;/Modules&gt;    <br />&lt;/Project&gt;</p>
<p>The thing to notice here is that there is a Second Module entry in the Config Section, this module has a different function to the standard one so needs a second declaration.&#160; The rest of the syntax in the module is straight from the documentation, I have a folder to copy to (URL) in this case its a DocumentLibrary, I have a Path that the file on the disk lives, in my case I have a sub folder in the SiteDef to store this file so I put that as its Path, if its in the root then leave it blank, Then in the &lt;FILE&gt; tag I define what files to copy etc.</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8f384e61-9fb7-4a6e-8188-1d693202ff0a" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a>,<a href="http://technorati.com/tags/moss" rel="tag">moss</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/08/wss-onet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WSS &#8211; Solutions</title>
		<link>http://www.binaryjam.com/2009/07/08/wss-solutions/</link>
		<comments>http://www.binaryjam.com/2009/07/08/wss-solutions/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 13:23:45 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2009/07/08/wss-solutions/</guid>
		<description><![CDATA[Just a silly one. I&#8217;ve decided to call the WSP solution packages for WSS, Wasps. It really appeals to me that I can send our support department a bunch of wasps. &#160; Technorati Tags: wss3,moss,sharepoint]]></description>
			<content:encoded><![CDATA[<p>Just a silly one.</p>
<p>I&#8217;ve decided to call the WSP solution packages for WSS, <strong>Wasps</strong>.</p>
<p>It really appeals to me that I can send our support department a bunch of wasps.</p>
<p>&#160;</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:65d9751c-f57d-42db-b974-17ea3638525b" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/wss3" rel="tag">wss3</a>,<a href="http://technorati.com/tags/moss" rel="tag">moss</a>,<a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2009/07/08/wss-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
