<?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>Wortell &#187; Paul Pascha</title>
	<atom:link href="http://blog.wortell.nl/author/paul/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.wortell.nl</link>
	<description>Wortell</description>
	<lastBuildDate>Fri, 03 Feb 2012 13:38:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Automatically approve ListItems if authorized to</title>
		<link>http://blog.wortell.nl/paul/automatically-approve-listitems-if-authorized-to/</link>
		<comments>http://blog.wortell.nl/paul/automatically-approve-listitems-if-authorized-to/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 09:01:39 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=890</guid>
		<description><![CDATA[When Content Approval is required on a SharePoint List or Library, every item added to or updated in the lists needs to get approved by someone with proper permissions. Even if the user adding or updating the item has the appropriate permissions to approve an item, additional steps are required for the user to do [...]]]></description>
			<content:encoded><![CDATA[<p>When Content Approval is required on a SharePoint List or Library, every item added to or updated in the lists needs to get approved by someone with proper permissions. Even if the user adding or updating the item has the appropriate permissions to approve an item, additional steps are required for the user to do this.</p>
<p>For the project I&#8217;m currently working on there&#8217;s a requirement to automatically approve items added to and updated in certain lists if the user adding or updating the item has permissions to approve the item. This prevents a user with such permissions having to perform additional steps (in different screens) to approve an item after adding or updating an item.</p>
<p>So, to make things easier and to provide this functionality I&#8217;ve implemented a SPItemEventReceiver which could be added to any list or library where this functionality is required. The event receiver code looks something like this:</p>
<div><code><br />
public override ItemUpdated()<br />
{<br />
    if (properties.List.EnableModeration)<br />
    {<br />
        if (properties.ListItem.DoesUserHavePermissions(SPBasePermissions.ApproveItems))<br />
        {<br />
            if (properties.ListItem.ModerationInformation.Status == SPModerationStatusType.Pending)<br />
            {<br />
                base.EventFiringEnabled = false;<br />
                properties.ListItem.ModerationInformation.Status = SPModerationStatusType.Approved;<br />
                properties.ListItem.Update();<br />
                base.EventFiringEnabled = true;         <br />
            }<br />
        }<br />
    }<br />
}</code></div>
<p>In this case I&#8217;m using ItemUpdated to  set the approval status. Note that in Libraries, an EventReceiver like this should probably better be attached to the ItemCheckedIn event instead&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/automatically-approve-listitems-if-authorized-to/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Extending SPListItem – GetRelatedListItems</title>
		<link>http://blog.wortell.nl/paul/extending-splistitem-getrelatedlistitems/</link>
		<comments>http://blog.wortell.nl/paul/extending-splistitem-getrelatedlistitems/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 20:07:36 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/paul/extending-splistitem-getrelatedlistitems/</guid>
		<description><![CDATA[SharePoint Foundation’s SPList API now contain’s a method which can be used to retrieve a SPList’s “Related Fields”. This method returns a collection of SPRelatedFields representing all the Lookup Columns pointing to the SPList in question. This methods can be used as the basis for writing a useful extension method on SPList which retrieves a [...]]]></description>
			<content:encoded><![CDATA[<p>SharePoint Foundation’s SPList API now contain’s a method which can be used to retrieve a SPList’s “Related Fields”. This method returns a collection of SPRelatedFields representing all the Lookup Columns pointing to the SPList in question. This methods can be used as the basis for writing a useful extension method on SPList which retrieves a collection, specifically in this case a generic List&lt;SPListItem&gt;.</p>
<p>The Code Snippet below shows the code that will ultimately return the entire collection of ListItems that related to the SPListItem the method is called on:</p>
<p><a href="http://blog.wortell.nl/wp-content/uploads/2010/08/code011.jpg"><img style="border-width: 0px" src="http://blog.wortell.nl/wp-content/uploads/2010/08/code01_thumb1.jpg" border="0" alt="code01" width="516" height="484" /></a></p>
<div>The following Code Snippet demonstrates usage of this extension method in a Console Application. The ConsoleApplication is targeting a SPWeb that has 3 lists. The List titled “Target” is reference by two related lists:</div>
<div> </div>
<div><a href="http://blog.wortell.nl/wp-content/uploads/2010/08/code021.jpg"><img style="border-width: 0px" src="http://blog.wortell.nl/wp-content/uploads/2010/08/code02_thumb1.jpg" border="0" alt="code02" width="516" height="330" /></a></div>
<div>The image below shows the console output when the code above is run:</div>
<div><a href="http://blog.wortell.nl/wp-content/uploads/2010/08/screen2.jpg"><img style="border-width: 0px" src="http://blog.wortell.nl/wp-content/uploads/2010/08/screen_thumb2.jpg" border="0" alt="screen" width="516" height="267" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/extending-splistitem-getrelatedlistitems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A little note on SPBuiltinContentTypeId usage</title>
		<link>http://blog.wortell.nl/paul/a-little-note-on-spbuiltincontenttypeid-usage/</link>
		<comments>http://blog.wortell.nl/paul/a-little-note-on-spbuiltincontenttypeid-usage/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 20:33:51 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=762</guid>
		<description><![CDATA[Recently, I got a question from a developer who was wondering why the following statement caused a System.NullReferenceException: SPContentType itemContentType = myCustomList.ContentTypes[SPBuiltInContentTypeId.Item]; The SPBuiltinContentTypeId Class contains static readonly fields representing all out-of-the-box ContentTypes in SharePoint Foundation (or WSS). The thing here is that when a Content Type is assigned to a List by using &#8220;Add [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I got a question from a developer who was wondering why the following statement caused a System.NullReferenceException:</p>
<p><code>SPContentType itemContentType = myCustomList.ContentTypes[SPBuiltInContentTypeId.Item];</code></p>
<p>The SPBuiltinContentTypeId Class contains static readonly fields representing all out-of-the-box ContentTypes in SharePoint Foundation (or WSS). The thing here is that when a Content Type is assigned to a List by using &#8220;Add from existing site content types&#8221; there actually is a new ContentType being generated under the hood. This newly generated ContentType actually inherits from the ContentType you selected to assign so it (initially) behaves exactly the same as it&#8217;s parent but it will have <strong>it&#8217;s own unique ID.</strong></p>
<p>The SPBuiltInContentTypeId Class&#8217; fields represent only the SPContentTypeIds of the ContentTypes typically instantiated at SiteCollection scope. Referencing a List-assigned version of the &#8220;same&#8221; ContentType won&#8217;t work using the overload of SPContentTypeCollection&#8217;s (SPList.ContentTypes) indexer taking a SPBuiltInContentTypeId because the ContentType has it&#8217;s own unique ID. In order to reference the List-scoped ContentType you should use one of the other two overloads of this class&#8217; indexer instead. The first is taking an Int32 representing the index of a ContentType whithin the collection. However, for a more predictable result I&#8217;d recommend using the overload accepting a string representing a ContentType&#8217;s name:</p>
<p><code>SPContentType itemContentType = myCustomList.ContentTypes["Item"];</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/a-little-note-on-spbuiltincontenttypeid-usage/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Disable code execution in Sandboxed Solutions for specific sitecollections</title>
		<link>http://blog.wortell.nl/paul/disable-code-execution-in-sandboxed-solutions-for-specific-sitecollections/</link>
		<comments>http://blog.wortell.nl/paul/disable-code-execution-in-sandboxed-solutions-for-specific-sitecollections/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 07:52:25 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[Microsoft SharePoint Online]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=505</guid>
		<description><![CDATA[Code in Sandboxed Solutions can execute as soon the &#8221;Microsoft SharePoint Foundation Sandboxed Code Service&#8221; is started on some server somewhere in your Farm. Sandboxed Solutions are hosted withing a specialized gallery within a SiteCollections&#8217; top level website. The provisioning of this gallery is controlled by the GLOBAL SiteDefinition meaning each SiteCollection you create (whether this Sandboxed Code service is [...]]]></description>
			<content:encoded><![CDATA[<p>Code in Sandboxed Solutions can execute as soon the &#8221;Microsoft SharePoint Foundation Sandboxed Code Service&#8221; is started on some server somewhere in your Farm. Sandboxed Solutions are hosted withing a specialized gallery within a SiteCollections&#8217; top level website. The provisioning of this gallery is controlled by the GLOBAL SiteDefinition meaning each SiteCollection you create (whether this Sandboxed Code service is running or not) will contain this gallery and by this enable SiteCollection Administrators to Upload and Activate Sandboxed Solutions.  </p>
<p>So by default, when the Sandboxed Code Service is started, each SiteCollection whithin each WebApplication in your Farm is enabled to execute code in Sandboxed Solutions. Sometimes however you might want to disable the execution of code in Sandboxed Solutions on specific sitecollections while still allowing them to execute on other SiteCollections. There is no neat way to disable code execution from Sandboxed Solutions entirely on a specific SiteCollections. Maybe you&#8217;d expect to find a checkbox labeled &#8220;Disable Code Execution in Sandboxed Solutions&#8221;  somewhere under Site Collection Settings  in Central Admin but there isn&#8217;t.</p>
<p>This requirement could be achieved however by specifying a Quota Template and configure a specific SiteCollection to use it. Follow the steps below to specifiy a Quota Template effectively disabling Sandboxed code execution on a certain SiteCollection.</p>
<p>1. Open Central Administration</p>
<p>2. Browse to Application Management</p>
<p>3. Under <strong>Site Collections</strong> click &#8220;Specify Quota Templates&#8221;</p>
<p>4. Specify &#8220;Create a new quota template&#8221; and specify a name for it. Optionally you could start from an existing template here.</p>
<p>5. At the bottom of this page there&#8217;s a section with options to control Sandboxed Solutions called &#8220;Sandboxed Solutions With Code Limits&#8221;. Specify &#8220;0&#8243; points in the TextBox labeled &#8220;Limit maximum usage per day to&#8221;</p>
<p>6. Click OK to save this template</p>
<p>7. Back on the Application Management Page, click &#8220;Configure Quotas and Locks&#8221;</p>
<p>8. On this Page, select the SiteCollection to apply the new quota template to</p>
<p>9. Under &#8220;Site Quota Information&#8221;, select the template just created</p>
<p>10. Click OK to save changes</p>
<p>Note that this will only block execution of custom code from within the Sandbox entirely. You are still able to provision declarative elements like List Instances for example to the Sandbox and use them without being blocked. I don&#8217;t think this is a problem however because otherwise the Site Collection administrator would have been able to create these kind of elements from within the browser or SharePoint designer anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/disable-code-execution-in-sandboxed-solutions-for-specific-sitecollections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What if “Datasheet View” does not work in lists and libraries?</title>
		<link>http://blog.wortell.nl/paul/what-if-datasheet-view-does-not-work-in-lists-and-libraries/</link>
		<comments>http://blog.wortell.nl/paul/what-if-datasheet-view-does-not-work-in-lists-and-libraries/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 19:28:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/what-if-datasheet-view-does-not-work-in-lists-and-libraries/</guid>
		<description><![CDATA[I was experiencing problems openening the &#8220;Datasheet View&#8221; of a SharePoint list. In my case, the issue was that ActiveX components where not allowed to run in the browser due to some security settings. While googling to find this solution I found some other things that might have caused the problem. Here they are: The [...]]]></description>
			<content:encoded><![CDATA[<p>I was experiencing problems openening the &#8220;Datasheet View&#8221; of a SharePoint list. In my case, the issue was that ActiveX components where not allowed to run in the browser due to some security settings. While googling to find this solution I found some other things that might have caused the problem. Here they are:</p>
<ul>
<li>The browser is too old: IE 5.01 with SP2 is required</li>
<li>The &#8220;Microsoft Office Access Web Datasheet Component&#8221; is not installed. This is included in Office 2007 and also available on the Office 2003 installation disc</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/what-if-datasheet-view-does-not-work-in-lists-and-libraries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using a Module to deploy a Solution to the Solution Gallery</title>
		<link>http://blog.wortell.nl/paul/using-a-module-to-deploy-a-solution-to-the-solution-gallery/</link>
		<comments>http://blog.wortell.nl/paul/using-a-module-to-deploy-a-solution-to-the-solution-gallery/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 18:24:10 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=356</guid>
		<description><![CDATA[For one of our projects I created several WebParts as part of a Sandboxed Solution. These WebParts were developed to be used on sites for which ultimately a SiteDefinition needed to be created. Since the WebParts are part of a Sandboxed Solution, my goal was to provision this solution as part of the SiteDefinition to the [...]]]></description>
			<content:encoded><![CDATA[<p>For one of our projects I created several WebParts as part of a Sandboxed Solution. These WebParts were developed to be used on sites for which ultimately a SiteDefinition needed to be created. Since the WebParts are part of a Sandboxed Solution, my goal was to provision this solution as part of the SiteDefinition to the Solution Gallery located in the RootWeb.</p>
<p>Since the Solution Gallery is just a specialized Document Library in which .wsp Files get placed, I thought using the Module element would help me here. Off course, you could use the Module element inside as a Feature element too, instead of the SiteDefintion I&#8217;m using it in. So, first of all I declared my Module element as follows:</p>
<p><code>&lt;Module Name="Solutions" Path="Solutions" Url="_catalogs/solutions"&gt;<br />
    &lt;File Url="HelloSandbox.wsp"/&gt;<br />
&lt;/Module&gt;</code></p>
<p>After creating a new SiteCollection based on the SiteDefinition containing this Module, I navigated to the solution gallery to find my .wsp file there in order to Activate the solution but it wasn&#8217;t there. It took me a while to figure out that in order to actually find the .wsp here, I needed to specify the Type within the <code><strong>&lt;File&gt;</strong></code>element with the value &#8220;GhostableInLibrary&#8221;.</p>
<p><code>&lt;Module Name="Solutions" Path="Solutions" Url="_catalogs/solutions"&gt;<br />
    &lt;File Url="HelloSandbox.wsp" Type="GhostableInLibrary"/&gt;<br />
&lt;/Module&gt;</code></p>
<p>Changing this made the .wsp appear but I wasn&#8217;t able to Activate the solution. I was wondering why until I chose to edit the properties of the .wsp and Save the changes without changing anything. After this, I was actually able to activate the solution!</p>
<p>So, editing the properties apparently caused some properties to be set under the hood. In order to figure out which properties, I decided to fire up <a href="http://spm.codeplex.com/" target="_blank">SharePoint Manager 2010</a>. This is a great tool to get useful insights. It helped me to figure out the following properties were added after editing the .wsp properties:</p>
<ul>
<li>ContentType</li>
<li>ContentTypeId</li>
<li>SolutionHasAssemblies</li>
<li>SolutionHash</li>
<li>SolutionId</li>
</ul>
<p>I decided to (as far as possible) specify the properties listed above one at a time in <code><strong>&lt;Property&gt;</strong></code> elements within the <code><strong>&lt;File&gt;</strong></code> element within the <code><strong>&lt;Module&gt;</strong></code>. By adding them one at a time I was hoping to find the minimum set of properties needed to be set.</p>
<p>I tried the ContentType property first. The value for ContentType (as I could see in SPM2010) was set to &#8220;Solution Gallery&#8221; so I declared the following <code><strong>&lt;Property&gt; </strong></code>element:</p>
<p><code>&lt;Property Name="ContentType" Value="Solution Gallery"/&gt;</code></p>
<p>I then created a new SiteCollection and now I was able to activate the solution! So this one property did the trick! Switching back to SPM2010 showed me that the other 4 properties from the listing above were also set now&#8230;</p>
<p>Hope this helps you too!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/using-a-module-to-deploy-a-solution-to-the-solution-gallery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilizing a Delegate Control to redirect to a custom User Profile Page</title>
		<link>http://blog.wortell.nl/paul/utilizing-a-delegate-control-to-redirect-to-a-custom-user-profile-page/</link>
		<comments>http://blog.wortell.nl/paul/utilizing-a-delegate-control-to-redirect-to-a-custom-user-profile-page/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 08:31:27 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/paul/utilizing-a-delegate-control-to-redirect-to-a-custom-user-profile-page/</guid>
		<description><![CDATA[For one of our customers’ intranet we are using a custom page to display User Profile information. By default, clicking a user’s name anywhere in SharePoint redirects you to the page Person.aspx within the “MySite Host”. This redirection is performed by a Control within the Application Page “userdisp.aspx” (_layouts/userdisp.aspx). The actual control is inserted by [...]]]></description>
			<content:encoded><![CDATA[<p>For one of our customers’ intranet we are using a custom page to display User Profile information. By default, clicking a user’s name anywhere in SharePoint redirects you to the page Person.aspx within the “MySite Host”. This redirection is performed by a Control within the Application Page “userdisp.aspx” (_layouts/userdisp.aspx). The actual control is inserted by means of a Delegate Control. This means you’re able to replace it with whatever custom Control you want by activating a Feature with a properly declared Control element.</p>
<p>The Delegate Control is declared with ControlID value “ProfileRedirection” and Scope “Farm”. This means the Feature with the Control element to insert a custom Control also needs to be Farm scoped. Thus, activating this Feature will result in replacing the redirect behaviour through the entire Farm. In our case, this was not a problem but be sure to keep this in mind.</p>
<p>The Feature’s Control Element declaration looks something like this:</p>
<pre><span class="kwrd">&lt;</span><span class="html">Elements</span> <span class="attr">xmlns</span><span class="kwrd">="http://schemas.microsoft.com/sharepoint/"</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">Control</span> <span class="attr">ControlAssembly</span><span class="kwrd">="Customer.Intranet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fe3fb3dd06bf9154"</span>
           <span class="attr">ControlClass</span><span class="kwrd">="Customer.Intranet.ProfileRedirectControl"</span>
           <span class="attr">Id</span><span class="kwrd">="ProfileRedirection"</span>
           <span class="attr">Sequence</span><span class="kwrd">="1"</span><span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">Elements</span><span class="kwrd">&gt;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/utilizing-a-delegate-control-to-redirect-to-a-custom-user-profile-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing, Deploying and Debugging Sandboxed Solutions – What if it doesn’t work right away?</title>
		<link>http://blog.wortell.nl/paul/developing-deploying-and-debugging-sandboxed-solutions-what-if-it-doesnt-work-right-away/</link>
		<comments>http://blog.wortell.nl/paul/developing-deploying-and-debugging-sandboxed-solutions-what-if-it-doesnt-work-right-away/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 09:45:48 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/paul/developing-deploying-and-debugging-sandboxed-solutions-what-if-it-doesnt-work-right-away/</guid>
		<description><![CDATA[Up to last week I used the simple “next, next, finish” single server installations for my developer workstation for SharePoint 2010. Everything including the sandbox worked fine and development went pretty smooth. Last week however I started developing on a new image with a more advanced installation of SharePoint 2010 in which Windows 2008 was [...]]]></description>
			<content:encoded><![CDATA[<p>Up to last week I used the simple “next, next, finish” single server installations for my developer workstation for SharePoint 2010. Everything including the sandbox worked fine and development went pretty smooth. Last week however I started developing on a new image with a more advanced installation of SharePoint 2010 in which Windows 2008 was setup as a domain controller.</p>
<p>When I launched Visual Studio for the first time to create  a simple Sandboxed WebPart and pressed &lt;F5&gt; to start debugging, I received an error stating that the SPUserCodeV4 service was not running:</p>
<p><a href="http://blog.wortell.nl/wp-content/uploads/2010/01/firsterror.jpg"><img style="border-width: 0px" src="http://blog.wortell.nl/wp-content/uploads/2010/01/firsterror_thumb.jpg" border="0" alt="firsterror" width="517" height="92" /></a></p>
<p>The error above was a quite obvious one and easy to fix by just starting this service from the “Services on Server” screen in Central Administrion:</p>
<p><a href="http://blog.wortell.nl/wp-content/uploads/2010/01/second.jpg"><img style="border-width: 0px" src="http://blog.wortell.nl/wp-content/uploads/2010/01/second_thumb.jpg" border="0" alt="second" width="518" height="399" /></a></p>
<p>So, I thought I was ready to press &lt;F5&gt; again but now another error appeared stating that Visual Studio was unable to attach to the SPUCWorkerProcess. My first thought was that this was probably some beta issue or an issue caused by not running Visual Studio as an administrator or something like that. My Solution was deployed to the solution gallery anyway so I planned to contiue placing my webpart on the page and attaching the debugger manually if needed. Placing the WebPart on the page however resulted in well ehh…nothing.</p>
<p>In order to confirm I was not doing anything not allowed in my code I changed the WebPart’s functionality to do nothing more then the  classical “Hello, World!”. That didn’t work either which meant I had to dig deeper. After binging around for a while, I found a <a href="http://blogs.msdn.com/opal/archive/2009/11/16/installation-notice-for-sharepoint-2010-public-beta.aspx">blogpost by Jie Li</a> in which he describes a PowerShell script to be run on computers that were setup as a domain controller (like mine). After running the PowerShell script below, everything worked fine!</p>
<pre>$acl = Get-Acl HKLM:\System\CurrentControlSet\Control\ComputerName
$person = [System.Security.Principal.NTAccount]<span class="str">"Users"</span>
$access = [System.Security.AccessControl.RegistryRights]::FullControl
$inheritance = [System.Security.AccessControl.InheritanceFlags]<span class="str">"ContainerInherit, ObjectInherit"</span>
$propagation = [System.Security.AccessControl.PropagationFlags]::None
$type = [System.Security.AccessControl.AccessControlType]::Allow
$rule = New-Object System.Security.AccessControl.RegistryAccessRule($person, $access, $inheritance, $propagation, $type)
$acl.AddAccessRule($rule)
Set-Acl HKLM:\System\CurrentControlSet\Control\ComputerName $acl</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/developing-deploying-and-debugging-sandboxed-solutions-what-if-it-doesnt-work-right-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SPContext anonymously</title>
		<link>http://blog.wortell.nl/paul/using-spcontext-anonymously/</link>
		<comments>http://blog.wortell.nl/paul/using-spcontext-anonymously/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 12:01:15 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=215</guid>
		<description><![CDATA[For one of our projects &#8211; a public facing site &#8211; we developed a custom control which renders an image. The control is placed within the MasterPage and the URL of the image to render is being determined by some rules. One of these rules is related to the PageLayout being used by the Page the user [...]]]></description>
			<content:encoded><![CDATA[<p>For one of our projects &#8211; a public facing site &#8211; we developed a custom control which renders an image. The control is placed within the MasterPage and the URL of the image to render is being determined by some rules. One of these rules is related to the PageLayout being used by the Page the user is visiting. For this rule to evaluate, we need the name of the PageLayout.</p>
<p>The most basic code I could think of for retrieving this value was the following</p>
<p><code>SPSecurity.RunWithElevatedPrivileges(delegate() {<br />
  PublishingPage currentPage = PublishingPage.GetPublishingPage(SPContext.Current.ListItem);<br />
  string pageLayoutName = currentPage.Layout.Name;<br />
});<br />
</code></p>
<p>Running this code using Windows authentication works fine. Running this code in anonymous context however caused a challenge to appear when executing the line where <code>pageLayoutName</code> is assigned a value. The reason for this is that some objects referenced in the SPContext object were already created outside of the elevated context. So, to retrieve the name of the current PageLayout, I had to instantiate most of the objects needed to get to the PageLayout object manually. The following code worked for me:</p>
<p><code>SPSecurity.RunWithElevatedPrivileges(delegate() {<br />
  using (SPSite siteCollection = new SPSite(SPContext.Current.Web.Site.Url))<br />
  </code><code>{<br />
    using (SPWeb web = siteCollection.OpenWeb())<br />
    {<br />
      PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);<br />
      SPListItem pageListItem = ublishingWeb.PagesList.ItemsSPContext.Current.File.UniqueId];<br />
      PublishingPage currentPage = PublishingPage.GetPublishingPage(pageListItem);<br />
      PageLayout currentPageLayout = currentPage.Layout;<br />
      currentPageLayoutName = currentPageLayout.Name;<br />
    }<br />
  }<br />
});</code></p>
<p>The example above is obviously a very specific case in which we needed the name of the PageLayout used by the current Page. The key message here however is to watch out using SPContext (and other high-level SharePoint objects) within an RunWithElevatedPrivileges block while in anonymous context. It&#8217;s very likely to run into some differences compared to using the same elevated code in Windows authenication context.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/using-spcontext-anonymously/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TryGetList method in SharePoint 2010</title>
		<link>http://blog.wortell.nl/paul/trygetlist-method-in-sharepoint-2010/</link>
		<comments>http://blog.wortell.nl/paul/trygetlist-method-in-sharepoint-2010/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 03:14:48 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/?p=146</guid>
		<description><![CDATA[There are many cases in which you want to retrieve a SPList object. In some cases you can&#8217;t just assume the list exists so before referencing it, you&#8217;d want to check this first. Within the WSS v3 object model there was no neat way to check for the existence of a list. Indexing into a [...]]]></description>
			<content:encoded><![CDATA[<p>There are many cases in which you want to retrieve a SPList object. In some cases you can&#8217;t just assume the list exists so before referencing it, you&#8217;d want to check this first. Within the WSS v3 object model there was no neat way to check for the existence of a list. Indexing into a SPListCollection based on for example the name of a non-existing list resulted in a System.NullReferenceException. For this reason, it was quite common to check for the existence of a SPList whitin a try-catch block.</p>
<p>In SharePoint 2010&#8242;s object model the SPListCollection Class has a new method called &#8220;TryGetList&#8221;. This method does exactly what the name suspects. Within the SPListCollection is being searched to a SPList with the specified name. If the list does not exist, a null reference is returned</p>
<p><code>SPSite currentSite = SPContext.Current.Site;<br />
SPList mySPList = currentSite.RootWeb.Lists.TryGetList("VoorbeeldLijst");</code><br />
<code><br />
if (mySPList != null)<br />
{<br />
  ...<br />
  ...<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/trygetlist-method-in-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint and Office 2010 public beta’s available now!</title>
		<link>http://blog.wortell.nl/paul/sharepoint-and-office-2010-public-betas-available-now/</link>
		<comments>http://blog.wortell.nl/paul/sharepoint-and-office-2010-public-betas-available-now/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 07:33:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[Office 2010]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/sharepoint-and-office-2010-public-betas-available-now/</guid>
		<description><![CDATA[The pubic beta&#8217;s for SharePoint 2010 and Office 2010 are available now! http://bit.ly/ZI2010]]></description>
			<content:encoded><![CDATA[<p>The pubic beta&#8217;s for SharePoint 2010 and Office 2010 are available now!</p>
<p><a href="http://bit.ly/ZI2010">http://bit.ly/ZI2010</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/sharepoint-and-office-2010-public-betas-available-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010: Developer Documentation (Technical Preview)</title>
		<link>http://blog.wortell.nl/paul/sharepoint-2010-developer-documentation-technical-preview/</link>
		<comments>http://blog.wortell.nl/paul/sharepoint-2010-developer-documentation-technical-preview/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 19:47:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/sharepoint-2010-developer-documentation-technical-preview/</guid>
		<description><![CDATA[Together with the 3 preview videos released today about SharePoint 2010, Microsoft released a first technical preview of the SharePoint 2010 developer documentation Download here]]></description>
			<content:encoded><![CDATA[<div>Together with the <a href="http://ppascha.blogspot.com/2009/07/sharepont-2010-sneak-peek-videos.html">3 preview videos</a> released today about SharePoint 2010, Microsoft released a first technical preview of the SharePoint 2010 developer documentation</div>
<div></div>
<div> </div>
<div>Download <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=94afe886-3b20-4bc9-9a0d-acd8cd232c24#tm">here</a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/sharepoint-2010-developer-documentation-technical-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePont 2010: Sneak Peek videos</title>
		<link>http://blog.wortell.nl/paul/sharepont-2010-sneak-peek-videos/</link>
		<comments>http://blog.wortell.nl/paul/sharepont-2010-sneak-peek-videos/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:05:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/sharepont-2010-sneak-peek-videos/</guid>
		<description><![CDATA[Today Microsoft published three videos as a Sneak Peek into SharePoint 2010: General Overview For IT Professionals For Developers The videos present a broad overview about what SharePoint 2010 will offer. Since I&#8217;m primarily a developer I had a very pleasant time watching the developer video. I can&#8217;t wait to get my hands on it [...]]]></description>
			<content:encoded><![CDATA[<p>Today Microsoft published three videos as a Sneak Peek into SharePoint 2010:
<div>
<ul>
<li><a href="http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/Overview-Video.aspx">General Overview</a></li>
<li><a href="http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/IT-Pro-video.aspx">For IT Professionals</a></li>
<li><a href="http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/Developer-video.aspx">For Developers</a></li>
</ul>
</div>
<div>
<div>The videos present a broad overview about what SharePoint 2010 will offer. Since I&#8217;m primarily a developer I had a very pleasant time watching the developer video. I can&#8217;t wait to get my hands on it and to see, hear &amp; feal more about SharePoint 2010 at the SharePoint Conference 2009 in Las Vegas!</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/sharepont-2010-sneak-peek-videos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending an e-mail with SPUtility from a site with anonymous access enabled</title>
		<link>http://blog.wortell.nl/paul/sending-an-e-mail-with-sputility-from-a-site-with-anonymous-access-enabled/</link>
		<comments>http://blog.wortell.nl/paul/sending-an-e-mail-with-sputility-from-a-site-with-anonymous-access-enabled/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 14:29:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/sending-an-e-mail-with-sputility-from-a-site-with-anonymous-access-enabled/</guid>
		<description><![CDATA[When using SPUtility.SendEmail() to send an e-mail message from within a site on which anonymous access is enabled, you have to specify the from address. The code in the fragment below is executed in the SendEmail method and explains why: email = messageHeaders["from"]; if (email == null){ email = web.CurrentUser.Email;}else{ email = FoldEmailHeader(email, "from", true); [...]]]></description>
			<content:encoded><![CDATA[<p>When using SPUtility.SendEmail() to send an e-mail message from within a site on which anonymous access is enabled, you have to specify the from address.</p>
<p>The code in the fragment below is executed in the SendEmail method and explains why:</p>
<pre style="font-size:8pt;color:#000000">email = messageHeaders[<span style="color:#006080">"from"</span>];

<span style="color:#0000ff">if</span> (email == <span style="color:#0000ff">null</span>){  email = web.CurrentUser.Email;}<span style="color:#0000ff">else</span>{  email = FoldEmailHeader(email, <span style="color:#006080">"from"</span>, <span style="color:#0000ff">true</span>);  count--;}</pre>
<p>
<p>The code listed above is being executed in the SendEmail method (obtained by using Reflector). As you can see, if the “from” address is not in the StringDictionary “messageHeaders”, the from address is being retrieved from web.CurrentUser. Since anonymous access is being used, this will obviously fail.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/sending-an-e-mail-with-sputility-from-a-site-with-anonymous-access-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Group your Validators</title>
		<link>http://blog.wortell.nl/paul/group-your-validators/</link>
		<comments>http://blog.wortell.nl/paul/group-your-validators/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 10:01:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/group-your-validators/</guid>
		<description><![CDATA[When you&#8217;re building a WebPart that uses some of the ASP.NET validator controls, make sure you specify a validation group for all of them and for the Control firing the validation (i.e. the Submit button). Also, if you&#8217;re using a validation summary specify it&#8217;s validation group property too. If you don&#8217;t do this, the validation [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re building a WebPart that uses some of the ASP.NET validator controls, make sure you specify a validation group for all of them and for the Control firing the validation (i.e. the Submit button). Also, if you&#8217;re using a validation summary specify it&#8217;s validation group property too.
<div></div>
<div>If you don&#8217;t do this, the validation might be fired by other controls rendered by SharePoint preventing you to navigate away from the page. I just ran into this since I created a new Page in a Publishing site. I added my WebPart to this Page and then I wanted to Publish the page. The &#8220;Submit for Approval&#8221; control in the &#8220;Page Editing Toolbar&#8221; fired the validation so I had to fill in all my required fields first in order to be able to enter the approval process.</div>
<div></div>
<div>So, I think it&#8217;s a best-practice to always use ValidationGroup inside of WebParts.
<div></div>
<div></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/group-your-validators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HideUnhide: My First JavaScript conflict in SharePoint</title>
		<link>http://blog.wortell.nl/paul/hideunhide-my-first-javascript-conflict-in-sharepoint/</link>
		<comments>http://blog.wortell.nl/paul/hideunhide-my-first-javascript-conflict-in-sharepoint/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 11:51:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/hideunhide-my-first-javascript-conflict-in-sharepoint/</guid>
		<description><![CDATA[It had to happen some day&#8230;. In the project we&#8217;re currently working on, we have a masterpage with a JavaScript powered menu. In this masterpage, a JavaScript function with the name HideUnhide was defined to toggle the visibility of parts of the menu.  Everything worked fine until we opened a page containing a webpart rendering [...]]]></description>
			<content:encoded><![CDATA[<div>It had to happen some day&#8230;.</div>
<div></div>
<p>In the project we&#8217;re currently working on, we have a masterpage with a JavaScript powered menu. In this masterpage, a JavaScript function with the name HideUnhide was defined to toggle the visibility of parts of the menu. 
<div></div>
<div>Everything worked fine until we opened a page containing a webpart rendering a SharePoint DateTimeControl. After some investigation, it appeared that the DateTimeControl is referencing a script file with the name datepicker.js from the \12\TEMPLATE\LAYOUTS folder.
<div></div>
<div>As you&#8217;ve probably already guessed it turned out that this script file also defines a function with the name HideUnhide. Renaming our MasterPage function obviously solved the issue.</div>
<div></div>
<div>There are lots of .js files in the 12 hive so there&#8217;s always a chance that a javascript function with the same name as the one you&#8217;re about to implement already exists. </div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/hideunhide-my-first-javascript-conflict-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reserved QueryString parameters in SharePoint</title>
		<link>http://blog.wortell.nl/paul/reserved-querystring-parameters-in-sharepoint/</link>
		<comments>http://blog.wortell.nl/paul/reserved-querystring-parameters-in-sharepoint/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 09:53:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/reserved-querystring-parameters-in-sharepoint/</guid>
		<description><![CDATA[While testing one of our webparts, I came across a weird problem in which the page containing the WebPart was not rendering if a QueryString parameter with the name &#8220;ID&#8221; was specified. Fortunately, Google helped me out listing this blog post in the search results. As stated in this blog post, you should not use [...]]]></description>
			<content:encoded><![CDATA[<p>While testing one of our webparts, I came across a weird problem in which the page containing the WebPart was not rendering if a QueryString parameter with the name &#8220;ID&#8221; was specified. Fortunately, Google helped me out listing <a href="http://blogs.technet.com/stefan_gossner/archive/2009/01/30/querystring-parameters-you-should-not-use-in-your-sharepoint-application.aspx">this blog post</a> in the search results.
<div></div>
<div>As stated in this blog post, you should not use the following QueryString parameter names:</div>
<div>
<div>
<ul>
<li>FeatureId</li>
<li>ListTemplate</li>
<li>List</li>
<li>ID</li>
<li>VersionNo</li>
<li>ContentTypeId</li>
<li>RootFolder</li>
<li>View</li>
<li>FolderCTID</li>
<li>Mode</li>
<li>Type</li>
</ul>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/reserved-querystring-parameters-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostBack problems when downloading files from a SharePoint WebPart</title>
		<link>http://blog.wortell.nl/paul/postback-problems-when-downloading-files-from-a-sharepoint-webpart/</link>
		<comments>http://blog.wortell.nl/paul/postback-problems-when-downloading-files-from-a-sharepoint-webpart/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 14:06:00 +0000</pubDate>
		<dc:creator>Paul Pascha</dc:creator>
				<category><![CDATA[Nieuws]]></category>
		<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.wortell.nl/robert/postback-problems-when-downloading-files-from-a-sharepoint-webpart/</guid>
		<description><![CDATA[For the project I’m currently working on, I needed to develop a WebPart which provides (among other functionality) a download link to a file stored in the database. I’ve used a LinkButton to render the download link and in it’s Click event I’m retrieving the file from the database and output it to the Response [...]]]></description>
			<content:encoded><![CDATA[<p>For the project I’m currently working on, I needed to develop a WebPart which provides (among other functionality) a download link to a file stored in the database. I’ve used a LinkButton to render the download link and in it’s Click event I’m retrieving the file from the database and output it to the Response stream like this:</p>
<div>
<pre>Page.Response.ClearContent();Page.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);Page.Response.ContentType = <span style="color: #006080">&quot;application/pdf&quot;</span>;Page.Response.AddHeader(<span style="color: #006080">&quot;Content-Disposition&quot;</span>, <span style="color: #006080">&quot;attachment; filename=document.pdf&quot;</span>);Page.Response.Buffer = <span style="color: #0000ff">true</span>;Page.Response.BinaryWrite(file);Page.Response.End();</pre>
<p></div>
<p>Now, when a user clicks the download button, a File Dowload Dialog is displayed in the browser. When this dialog is closed the page is not responding to any click within the webpart’s content that normally would cause a postback to occur. With a little Googling, I found <a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/55136e4e-e1f7-4a79-9b75-be09cd5594c2/">this</a> thread which fully describes the cause of the problem and provides a neat solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wortell.nl/paul/postback-problems-when-downloading-files-from-a-sharepoint-webpart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

