<?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>ThumNet &#187; sharepoint2010</title>
	<atom:link href="http://blog.thumnet.com/tag/sharepoint2010/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thumnet.com</link>
	<description>Just a ThumNet blog</description>
	<lastBuildDate>Fri, 06 Aug 2010 09:34:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Automatically connect WebParts on a SharePoint page</title>
		<link>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/</link>
		<comments>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 09:34:55 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[sharepoint2007]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[webpart]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=201</guid>
		<description><![CDATA[For a recent project we had several WebParts (Provider and Consumer webparts) on a page which had to be connected to each other when the page was provisioned by our solution. Unfortunately this cannot be done within the Module.xml So I created a method which automatically connects the consumer WebParts to their correct provider WebParts. [...]]]></description>
			<content:encoded><![CDATA[<p>For a recent project we had several WebParts (Provider and Consumer webparts) on a page which had to be connected to each other when the page was provisioned by our solution.</p>
<p>Unfortunately this cannot be done within the Module.xml <img src='http://blog.thumnet.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>So I created a method which automatically connects the consumer WebParts to their correct provider WebParts.</p>
<p>To do this I basically used the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.splimitedwebpartmanager.aspx">SPLimitedWebPartManager</a>, <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.providerconnectionpoint.aspx">ProviderConnectionPoint</a>, <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webparts.consumerconnectionpoint.aspx">ConsumerConnectionPoint </a>and some other nice classes.</p>
<p><strong>The method (warning long block of code)</strong></p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Connects the web parts on page.
/// &lt;/summary&gt;
/// &lt;param name=&quot;web&quot;&gt;The web.&lt;/param&gt;
/// &lt;param name=&quot;pageUrl&quot;&gt;The page URL.&lt;/param&gt;
/// &lt;param name=&quot;publish&quot;&gt;if set to &lt;c&gt;true&lt;/c&gt; [publish].&lt;/param&gt;
public static void ConnectWebPartsOnPage(SPWeb web, string pageUrl, bool publish)
{
	// get the page from the url
	SPFile page = web.GetFile(pageUrl);

	// make sure the page exists
	if (page.Exists)
	{
		// if the page is checked out, check it in because then the user can do an rollback
		if (page.Level == SPFileLevel.Checkout)
		{
			page.CheckIn(&quot;Page was checked out, needs to be checked in before connecting webparts&quot;, SPCheckinType.MinorCheckIn);
		}

		// check out the page because we are going to do changes on it
		page.CheckOut();

		// get the webpartmanager for the page
		using (Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager mgr = page.GetLimitedWebPartManager(PersonalizationScope.Shared))
		{
			try
			{
				// try to connect the webparts on the page
				if (ConnectWebParts(mgr))
				{
					string checkinComment = &quot;Auto connected WebParts on page&quot;;

					// webparts are connected so update the page and check it in
					page.Update();
					page.CheckIn(checkinComment);

					if (publish)
					{
						page.Publish(checkinComment);
						page.Approve(checkinComment);
					}
				}
			}
			catch (Exception ex)
			{
				page.UndoCheckOut();
				throw ex;
			}
		}
	}
}

/// &lt;summary&gt;
/// Checks if a WebPart connection exists.
/// &lt;/summary&gt;
/// &lt;param name=&quot;connections&quot;&gt;The connections.&lt;/param&gt;
/// &lt;param name=&quot;provider&quot;&gt;The provider.&lt;/param&gt;
/// &lt;param name=&quot;consumer&quot;&gt;The consumer.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static bool WebPartConnectionExist(Microsoft.SharePoint.WebPartPages.SPWebPartConnectionCollection connections,
	System.Web.UI.WebControls.WebParts.WebPart provider, System.Web.UI.WebControls.WebParts.WebPart consumer)
{
	foreach (Microsoft.SharePoint.WebPartPages.SPWebPartConnection conn in connections)
	{
		if (conn.Provider == provider &amp;&amp; conn.Consumer == consumer)
		{
			return true;
		}
	}

	return false;
}

/// &lt;summary&gt;
/// Connects the web parts.
/// &lt;/summary&gt;
/// &lt;param name=&quot;manager&quot;&gt;The manager.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static bool ConnectWebParts(Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager manager)
{
	bool connectionMade = false;

	// get the webparts on the page
	Microsoft.SharePoint.WebPartPages.SPLimitedWebPartCollection webparts = manager.WebParts;

	// only continu if there are any webparts
	if (webparts.Count &gt; 0)
	{
		ProviderConnectionPointCollection provColl;
		ConsumerConnectionPointCollection consColl;
		// walk through all the webparts on the page to find provider webparts
		foreach (System.Web.UI.WebControls.WebParts.WebPart providerPart in webparts)
		{

			// check if the webpart is a Provider webpart
			provColl = manager.GetProviderConnectionPoints(providerPart);
			if (provColl != null &amp;&amp; provColl.Default != null)
			{

				// walk through all the webparts on the page again now to find the consumer webparts
				foreach (System.Web.UI.WebControls.WebParts.WebPart consumerPart in webparts)
				{

					// first make sure the webpart isn't the provider webpart
					if (consumerPart != providerPart)
					{
						// check if the webpart is a Consumer webpart,
						// then make sure the consumer webpart isn't already connected to the provider webpart
						// then check if the interface of the consumer webpart is assignable from the interface of the provider webpart
						consColl = manager.GetConsumerConnectionPoints(consumerPart);
						if (consColl != null &amp;&amp; consColl.Default != null
							&amp;&amp; !WebPartConnectionExist(manager.SPWebPartConnections, providerPart, consumerPart)
							&amp;&amp; consColl.Default.InterfaceType.IsAssignableFrom(provColl.Default.InterfaceType))
						{
							// connect the webparts
							manager.SPConnectWebParts(providerPart, provColl.Default, consumerPart, consColl.Default);
							connectionMade = true;
						}
					}
				}
			}
		}
	}
	return connectionMade;
}
</pre>
<p><strong>Sample usage (console application)</strong></p>
<pre class="brush: csharp;">
try
{
	using (SPSite site = new SPSite(&quot;http://localhost&quot;))
	using (SPWeb web = site.OpenWeb())
	{
		ConnectWebPartsOnPage(web, &quot;pages/default.aspx&quot;, false);
	}
}
catch (Exception ex)
{
	Console.WriteLine();
	Console.WriteLine(&quot;Message:\n{0}\n\nStack:\n{1}\n\n&quot;, ex.Message, ex.StackTrace);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/automatically-connect-webparts-on-sharepoint-page/201/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>First NEN 2082 certified project with SharePoint 2010</title>
		<link>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/</link>
		<comments>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 15:01:39 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[nen2082]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=180</guid>
		<description><![CDATA[Together with 3 colleagues from QNH Business Integration I am currently finishing implementing a already NEN 2082 certified project based on SharePoint 2010. When SharePoint 2010 hits RTM there will be another audit for this version of SharePoint, because currently the pre release version has been certified. NEN 2082 is a Dutch standard which is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="QNH" src="http://www.qnh.eu/images/stories/logos/qnhLogo.png" alt="" width="190" height="65" /><br />
Together with 3 colleagues from QNH Business Integration I am currently finishing implementing a already NEN 2082 certified project based on SharePoint 2010.<br />
When SharePoint 2010 hits RTM there will be another audit for this version of SharePoint, because currently the pre release version has been certified.</p>
<p>NEN 2082 is a Dutch standard which is similar the DoD5015 and MoReq standards. </p>
<p>This project was done for the Gemeente Nieuwegein, which is a Dutch local Government.</p>
<div id="attachment_181" class="wp-caption aligncenter" style="width: 130px"><a href="http://blog.thumnet.com/wp-content/uploads/2010/03/NieuwegeinLogo.png" rel="lightbox[180]"><img class="size-full wp-image-181" title="Nieuwegein Logo" src="http://blog.thumnet.com/wp-content/uploads/2010/03/NieuwegeinLogo.png" alt="" width="120" height="120" /></a><p class="wp-caption-text">Gemeente Nieuwegein</p></div>
<p>For this project we have also been nominated for the &#8220;Innovation of the year&#8221; award:</p>
<div id="attachment_182" class="wp-caption aligncenter" style="width: 235px"><a href="http://blog.thumnet.com/wp-content/uploads/2010/03/lrg-partner-award-2010.jpg" rel="lightbox[180]"><img class="size-medium wp-image-182" title="LRG Innovator Nomination 2010" src="http://blog.thumnet.com/wp-content/uploads/2010/03/lrg-partner-award-2010-225x300.jpg" alt="" width="225" height="300" /></a><p class="wp-caption-text">LRG Innovator Nomination 2010</p></div>
<p><a href="http://www.qnh.eu/actueel/210-qnh-implementeert-als-eerste-dmsrma-met-sharepoint-2010-conform-nen2082">More information</a> (Dutch)</p>
<p>My colleagues at QNH:</p>
<ul>
<li>Jeroer Derde &#8211; <a href="http://derde.net/blog">http://derde.net/blog</a></li>
<li>Alexander Ketelaar &#8211; <a href="http://sharepoint2010.nl">http://sharepoint2010.nl</a></li>
<li>Robert Sep</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/first-nen2082-certified-project-sharepoint-2010/180/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem with VS2010 beta 2 Site Definition</title>
		<link>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/</link>
		<comments>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 10:40:23 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[site-definition]]></category>
		<category><![CDATA[visualstudio2010]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=159</guid>
		<description><![CDATA[I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2. The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition. Error message: Error An error occurred while getting items from the &#34;&#34; provider: Cannot complete this action. Please try [...]]]></description>
			<content:encoded><![CDATA[<p>I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2.</p>
<p>The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition.</p>
<div id="attachment_164" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/00-error-while-creating-document-library.png" rel="lightbox[159]"><img class="size-medium wp-image-164" title="00-error-while-creating-document-library" src="http://blog.thumnet.com/wp-content/uploads/2009/12/00-error-while-creating-document-library-300x188.png" alt="Error while trying to add a new Document Library" width="300" height="188" /></a><p class="wp-caption-text">Error while trying to add a new Document Library</p></div>
<p><strong>Error message:</strong></p>
<pre class="brush: plain;">
Error

An error occurred while getting items from the &quot;&quot; provider:
Cannot complete this action.

Please try again.
</pre>
<p><em>Read on to see the solution for this error.</em></p>
<p>Visual Studio 2010 now has native integration of SharePoint 2010 projects.</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/01-new-site-definition-in-vs2010.png" rel="lightbox[159]"><img class="size-medium wp-image-160" title="01-new-site-definition-in-vs2010" src="http://blog.thumnet.com/wp-content/uploads/2009/12/01-new-site-definition-in-vs2010-300x168.png" alt="New Site Definition in Visual Studio 2010" width="300" height="168" /></a><p class="wp-caption-text">New Site Definition in Visual Studio 2010</p></div>
<p>After creating the new Site Definition Project in the <strong>onet.xml</strong> file<strong> </strong>contains the following:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Project Title=&quot;SampleSiteDefinition&quot; Revision=&quot;2&quot; ListDir=&quot;&quot; xmlns:ows=&quot;Microsoft SharePoint&quot; xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;NavBars&gt;
  &lt;/NavBars&gt;
  &lt;Configurations&gt;
    &lt;Configuration ID=&quot;0&quot; Name=&quot;SampleSiteDefinition&quot;&gt;
      &lt;Lists/&gt;
      &lt;SiteFeatures&gt;
      &lt;/SiteFeatures&gt;
      &lt;WebFeatures&gt;
      &lt;/WebFeatures&gt;
      &lt;Modules&gt;
        &lt;Module Name=&quot;DefaultBlank&quot; /&gt;
      &lt;/Modules&gt;
    &lt;/Configuration&gt;
  &lt;/Configurations&gt;
  &lt;Modules&gt;
    &lt;Module Name=&quot;DefaultBlank&quot; Url=&quot;&quot; Path=&quot;&quot;&gt;
      &lt;File Url=&quot;default.aspx&quot;&gt;
      &lt;/File&gt;
    &lt;/Module&gt;
  &lt;/Modules&gt;
&lt;/Project&gt;
</pre>
<p><em>Now you can modify to the onet.xml and default.aspx as you like. </em></p>
<p>When deploying the new Site Definition, creating a site, and then trying to create a new Document Library you get the error above.  The solution for the error turned out to be the <strong>missing </strong>declaration of the <strong>&lt;DocumentTemplates&gt;</strong> XML node.</p>
<p>Correct default <strong>onet.xml</strong> should be:</p>
<pre class="brush: xml; highlight: [5,6];">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Project Title=&quot;SampleSiteDefinition&quot; Revision=&quot;2&quot; ListDir=&quot;&quot; xmlns:ows=&quot;Microsoft SharePoint&quot; xmlns=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;
  &lt;NavBars&gt;
  &lt;/NavBars&gt;
  &lt;DocumentTemplates&gt;
  &lt;/DocumentTemplates&gt;
  &lt;Configurations&gt;
      &lt;Lists/&gt;
      &lt;SiteFeatures&gt;
      &lt;/SiteFeatures&gt;
      &lt;WebFeatures&gt;
      &lt;/WebFeatures&gt;
      &lt;Modules&gt;
        &lt;Module Name=&quot;DefaultBlank&quot; /&gt;
      &lt;/Modules&gt;
    &lt;/Configuration&gt;
  &lt;/Configurations&gt;
  &lt;Modules&gt;
    &lt;Module Name=&quot;DefaultBlank&quot; Url=&quot;&quot; Path=&quot;&quot;&gt;
      &lt;File Url=&quot;default.aspx&quot;&gt;
      &lt;/File&gt;
    &lt;/Module&gt;
  &lt;/Modules&gt;
&lt;/Project&gt;
</pre>
<p>After re-deploying the Site Definition and creating a new Site, you are able to create a Document Library.</p>
<div id="attachment_170" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.thumnet.com/wp-content/uploads/2009/12/02-correctly-working-new-doclib-screen.png" rel="lightbox[159]"><img class="size-medium wp-image-170" title="02-correctly-working-new-doclib-screen" src="http://blog.thumnet.com/wp-content/uploads/2009/12/02-correctly-working-new-doclib-screen-300x188.png" alt="Working new Document Library" width="300" height="188" /></a><p class="wp-caption-text">Working new Document Library</p></div>
<h5>Reference:</h5>
<p><a href="http://msdn.microsoft.com/en-us/library/ms474369(office.14).aspx">Microsoft&#8217;s Reference for SharePoint 2010 onet.xml</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/problem-vs2010-beta2-sitedefinition/159/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Looking for SharePoint 2010 Feature (GU)IDs</title>
		<link>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/</link>
		<comments>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 17:23:29 +0000</pubDate>
		<dc:creator>Jeffrey Tummers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[feature-guid]]></category>
		<category><![CDATA[qnh]]></category>
		<category><![CDATA[sharepoint2010]]></category>
		<category><![CDATA[site-definition]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.thumnet.com/?p=142</guid>
		<description><![CDATA[Have you ever been looking for a feature (GU)ID in SharePoint? Well here is an easy way to find them. I needed default SharePoint feature guids for the development of a custom Site Definition. Using a custom Site Definition you can automatically activate SharePoint features within the onet.xml file. Here we go: Open the SharePoint [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been looking for a feature (GU)ID in SharePoint? Well here is an easy way to find them.</p>
<p>I needed default SharePoint feature guids for the development of a custom Site Definition. Using a custom Site Definition you can automatically activate SharePoint features within the onet.xml file.</p>
<p>Here we go:</p>
<ol>
<li>Open the SharePoint site in IE8 (or IE7).</li>
<li style="text-align: left;">Go to the Site Settings page.<br />
<img class="size-full wp-image-143" title="site-settings-menu" src="http://blog.thumnet.com/wp-content/uploads/2009/12/site-settings-menu.jpg" alt="site-settings-menu" width="259" height="587" /></li>
<li>Click on the Manage Site features (or Site Collection features)<br />
<img class="alignnone size-full wp-image-144" title="site-features" src="http://blog.thumnet.com/wp-content/uploads/2009/12/site-features.jpg" alt="site-features" width="287" height="131" /></li>
<li>Use the Developer Tools (shortcut F12)</li>
<li>Click in the toolbar on Find &#8211;&gt; Select Element by Click (shortcut CTRL+B, but this opens bookmarks manager on my machine)<br />
<img class="alignnone size-full wp-image-145" title="developertools-select" src="http://blog.thumnet.com/wp-content/uploads/2009/12/developertools-select.jpg" alt="developertools-select" width="393" height="168" /></li>
<li>Select the Activate (or Deactivate) button next to the feature you need the GUID from.<br />
<img class="alignnone size-full wp-image-147" title="select-feature-activate-button" src="http://blog.thumnet.com/wp-content/uploads/2009/12/select-feature-activate-button.jpg" alt="select-feature-activate-button" width="748" height="84" /></li>
<li>Developer Tools scrolls down to the HTML source for the specific button, the button tag is contained within a Div tag. This Div tag contains an ID attribute and thats the GUID for the feature!<br />
<img class="alignnone size-full wp-image-148" title="selected-feature-html" src="http://blog.thumnet.com/wp-content/uploads/2009/12/selected-feature-html.jpg" alt="selected-feature-html" width="502" height="213" /></li>
<li>In this case the GUID is: <strong>9c03e124-eef7-4dc6-b5eb-86ccd207cb87</strong><br />
<img class="alignnone size-full wp-image-149" title="selected-feature-guid" src="http://blog.thumnet.com/wp-content/uploads/2009/12/selected-feature-guid.jpg" alt="selected-feature-guid" width="492" height="145" /></li>
</ol>
<p>This trick also works for SharePoint 2007!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.thumnet.com/looking-for-sharepoint-2010-feature-guid/142/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
