<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Erwin van der Valk's blog: Practicing patterns : Sharepoint</title><link>http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx</link><description>Tags: Sharepoint</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Sharepoint guidance v2 – drop 9</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/05/13/sharepoint-guidance-v2-drop-9.aspx</link><pubDate>Wed, 13 May 2009 19:16:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9609532</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9609532.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9609532</wfw:commentRss><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;This week, we published the results of interation 9 to our codeplex site. &lt;/p&gt;  &lt;p&gt;You can get it here:&lt;/p&gt;  &lt;p&gt;&lt;a title="SPG Drop 9" href="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27299" target="_blank"&gt;http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27299&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this drop, we have addressed a number of tasks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Implemented trusted facade pattern and removed the fake SSO provider &lt;/li&gt;    &lt;li&gt;Refactored the repositories to make better use of WCF Proxies &lt;/li&gt;    &lt;li&gt;Support for UpdatePanel in SafeScriptManager &lt;/li&gt;    &lt;li&gt;Updated PartnerLandingPage &lt;/li&gt;    &lt;li&gt;Removed most usages of .net 3.5 &lt;/li&gt;    &lt;li&gt;Provided instructions on how to use a host name to access extranet site &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Trusted facade pattern&lt;/h1&gt;  &lt;p&gt;We are demonstrating in our RI how to call back-end services from SharePoint. It’s quite common to have different credentials to log on to back end services. &lt;/p&gt;  &lt;h2&gt;Replacing the fake SSO provider&lt;/h2&gt;  &lt;p&gt;Before, we were using a fake SSO provider (Single Sign On) for that. We built a fake SSO provider because it’s actually quite hard and complex to build a real SSO provider. Since the SSO provider should store passwords in a secure way, there are a whole range of attacks you need to watch for. We felt we didn’t want to take on that extra complexity in our project, so we built a fake SSO provider that stored the passwords in clear text. We hoped that calling it ‘fake’ would make it clear enough that this is not something you would want to do in production. &lt;/p&gt;  &lt;p&gt;We a lot of feedback that giving an example that shows how to store passwords in clear text is bad. No matter how clearly you explain that it’s not something you want to do in production, somebody is going to do it anyway. But since didn’t want to show you how to build a real SSO provider (that would be a project in itself), we decided to change our implementation to a trusted facade.&amp;#160; &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Trusted facade explained&lt;/h2&gt;  &lt;p&gt;The following diagram shows the trusted facade pattern:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_thumb_1.png" width="534" height="278" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A user authenticates with the trusted facade. It validates the credentials provided by the user. Then, if the trusted facade calls the back end service on behalf of the user, it only specifies the username. The back end service trusts the Trusted Facade to provide the correct username, so it doesn’t need to perform any authentication. &lt;/p&gt;  &lt;p&gt;We implemented our trusted facade based on this &lt;a title="MSDN Article that describes how to implement the trusted facade." href="http://msdn.microsoft.com/en-us/library/aa355058.aspx" target="_blank"&gt;MSDN article&lt;/a&gt;. Our implementation looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/Sharepointguidancev2drop9_C207/image_thumb_2.png" width="765" height="464" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;A user connects to SharePoint either through windows authentication or through Forms Based Authentication (FBA). Then, when the user wants to make a request to a backend system, for example to retrieve the price for a product, the pricing repository will find out what partner the user belongs to. It will then call the back end service with the name of the partner. The pricing service trusts our SharePoint application to provide the correct partner name, so it doesn’t require any passwords.&amp;#160; &lt;/p&gt;  &lt;p&gt;Of course, you have to make sure that only the account that SharePoint runs under is allowed to access the pricing service. &lt;/p&gt;  &lt;h1&gt;Repository refactoring&lt;/h1&gt;  &lt;p&gt;We took a critical look at our current implementation of the repositories. &lt;/p&gt;  &lt;p&gt;The goal of the repositories is to hide data access logic from consumers. For example, we have a ProductCatalogRepository, which has methods like: GetProduct(string sku) to retrieve product information. This repository uses the BDC for some of it’s methods, but for other, it calls into our productcatalog webservices directly. However, the consumers of these repositories don’t know where the data comes from. They also don’t know (and don’t care) that the data is cached. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Webservice proxies&lt;/h2&gt;  &lt;p&gt;Adding a reference to a webservice is very simple in Visual Studio. What happens under the covers is quite a bit more complex. Visual studio will generate proxy classes based on the metadata that’s returned from the service. &lt;/p&gt;  &lt;p&gt;We implemented the following best practices for calling web services:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;If your service references are used by multiple projects, create a single project that holds the service references and reference that project.        &lt;br /&gt;&lt;/strong&gt;There are to reasons for this. If you are making changes to your webservice, you only have to update one service reference. Forgetting to update one can cause annoying bugs. But from a design perspective, if you generate two proxies for the same web service, then you’ll have duplicate (incompatible) types in your system. For example, the price object generated for proxy 1 will be different from the price object generated for proxy 2. Even though they have exactly the same signature, you can’t reuse the types for them or reuse methods that work on them. We implemented this in the Contoso.Pss.Services.Client solution.       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Don’t call the service proxies directly, but wrap the calls to the service proxies into repositories or service agents.        &lt;br /&gt;&lt;/strong&gt;This best practice is used to shield your application from (minor) changes to the service. It does take some extra coding, because you have to transform the objects you get back from the service into objects that can be used by your application. So this practice does adds a level of indirection and extra complexity to your application, so you have to make the tradeoff if the extra complexity is worth the isolation. In general, if the services are created for and only used by your application, you typically don’t need such a level of indirection. However, if you don’t have control over your services or other clients are also using the services, it’s often worth it. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;There were a couple of area’s we explicitly didn’t look at. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;Getting the repositories from the service locator&lt;/h2&gt;  &lt;p&gt;Before, we were creating the repositories directly in our code, for example in our presenters. This is often undesirable, because it makes the presenters harder to unit test. Now, we have registered the repositories in our service locator. Therefore, we can use the service locator to get instances of our repositories and we are able to mock out these in our unit tests. Sweet :)&lt;/p&gt;  &lt;h1&gt;UpdatePanel in sharepoint&lt;/h1&gt;  &lt;p&gt;SharePoint has a slightly different method for implementing post backs than the normal ASP.Net framework. It uses a custom javascript method that is called on postback. Unfortunately, this means that the Ajax UpdatePanel doesn’t work out of the box, because it also requires a different postback method. The solution is to emit some JavaScript code that intercepts the postback event and calls the normal UpdatePanel posback code. &lt;/p&gt;  &lt;p&gt;In order to get the UpdatePanel to work, you need a scriptmanager, because that will add the required javascript code for the async postback to the page. We had already built a SafeScriptManager, that you can add several times to a page without causing issues. So it was natural to add some functionality to it to enable support for the UpdatePanel. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Removed most .net 3.5 usages&lt;/h1&gt;  &lt;p&gt;We were making judicious use of the wonderful new features of .Net 3.5 such as Linq queries, lambda expressions and type initializers. However, we got the feedback from our advisors that .net 3.5 is not widely used by the sharepoint developer community. After many discussions, we agreed that removing most of the .net 3.5 usages would make our guidance a bit more consumable by the sharepoint developer community. &lt;/p&gt;  &lt;h1&gt;Added instructions on how to use a host name to access extranet site&lt;/h1&gt;  &lt;p&gt;Lastly, we added some instructions on how to use a host name to access extranet sites. Now, our extranet site is accessable on localhost:9001. If you would prefer to host the extranet site on a hostname, for example extranet.mydomain.com, we have included instructions on how to do that. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9609532" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>sharepoint guidance drop 8 video online</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/04/30/sharepoint-guidance-drop-8-video-online.aspx</link><pubDate>Thu, 30 Apr 2009 20:08:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9580789</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9580789.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9580789</wfw:commentRss><description>&lt;p&gt;Hi guys,&lt;/p&gt;  &lt;p&gt;Our drop 8 video is online on Channel 9. Check it out:&lt;/p&gt; &lt;iframe height="325" src="http://channel9.msdn.com/posts/akmsft/467414/player/" frameborder="0" width="320" scrolling="no" mce_src="http://channel9.msdn.com/posts/akmsft/467414//player/"&gt;&lt;/iframe&gt;  &lt;p&gt;Happy watching and keep practicing!&lt;/p&gt;  &lt;p&gt;_Erwin&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9580789" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>program to interface… in sharepoint</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/04/10/program-to-interface-in-sharepoint.aspx</link><pubDate>Fri, 10 Apr 2009 21:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9543793</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9543793.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9543793</wfw:commentRss><description>&lt;P&gt;&lt;EM&gt;[Update]&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I’ve posted a workaround&amp;nbsp;to this issue here: &lt;/EM&gt;&lt;A title=http://blogs.msdn.com/erwinvandervalk/archive/2009/06/08/using-interfaces-and-base-classes-in-different-assembly-using-vsewss-1-3.aspx href="http://blogs.msdn.com/erwinvandervalk/archive/2009/06/08/using-interfaces-and-base-classes-in-different-assembly-using-vsewss-1-3.aspx"&gt;&lt;EM&gt;&lt;FONT color=#ff9900&gt;http://blogs.msdn.com/erwinvandervalk/archive/2009/06/08/using-interfaces-and-base-classes-in-different-assembly-using-vsewss-1-3.aspx&lt;/FONT&gt;&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt;.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Original post]&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the common practices I try to follow is: Program to interface, not implementation. &lt;/P&gt;
&lt;P&gt;It allows you to decouple components from each other and easily plug in different implementation. This is great for test driven development, where you can replace all the dependencies of the object under test with Mock objects.&lt;/P&gt;
&lt;P&gt;But when I tried to do something similar in our Sharepoint Guidance project, I ran into a problem with the &lt;A title="Visual Studio Extensions for Windows Sharepoint Services (VSSeWSS) 1.3" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=B2C0B628-5CAB-48C1-8CAE-C34C1CCBDC0A&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=B2C0B628-5CAB-48C1-8CAE-C34C1CCBDC0A&amp;amp;displaylang=en"&gt;Visual Studio Extensions for Windows Sharepoint Services (VSSeWSS) 1.3&lt;/A&gt;. &lt;/P&gt;
&lt;H2&gt;&lt;/H2&gt;
&lt;H1&gt;The problem&lt;/H1&gt;
&lt;P&gt;I had created two assemblies, one with an interface definition and the other with the actual implementation. Seems pretty basic, but when I tried to use it to create a WSP package, I got the following error:&lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=2 width=700&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=700&gt;
&lt;P&gt;Error&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; VSeWSS Service Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. &lt;/P&gt;
&lt;P&gt;Log file written to: C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\VSeWSS 1.3\VSeWSS1.3 service.log&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;Ok, maybe the log file explains what’s wrong?&lt;/P&gt;
&lt;TABLE border=1 cellSpacing=0 cellPadding=2 width=700&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=700&gt;
&lt;P&gt;2009/04/10 11:13:59&amp;nbsp;&amp;nbsp;&amp;nbsp; Error &lt;BR&gt;System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.Module._GetTypesInternal(StackCrawlMark&amp;amp; stackMark) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at System.Reflection.Module.GetTypes() &lt;BR&gt;&amp;nbsp;&amp;nbsp; at Microsoft.SharePoint.Tools.Reflection.ModuleWrapper.GetTypes() &lt;BR&gt;&amp;nbsp;&amp;nbsp; at Microsoft.SharePoint.Tools.Reflection.TypeFinder.GetTypesAsType(IAssemblyWrapper assembly, ITypeWrapper targetType) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at Microsoft.SharePoint.Tools.Reflection.TypeFinder.Find(IAssemblyWrapper assembly, ITypeWrapper targetType) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at Microsoft.SharePoint.Tools.SharePointProxies.WSPViewFacade.CreateWebPartReferenceResolverClassMap(String[] paths) &lt;BR&gt;&amp;nbsp;&amp;nbsp; at VSeWSS.Server.Services.SPService.CreateWebPartReferenceResolverClassMap(String[] paths) &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;How incredibly useful. &lt;/P&gt;
&lt;H1&gt;The solution&lt;/H1&gt;
&lt;P&gt;After a lot of puzzling, I found out that the VSSeWSS 1.3 tool has problems with separating the implementation and interfaces in seperate DLL’s. Even if you reference the DLL’s, but not add project references, it gives the previous error message when packaging it. &lt;/P&gt;
&lt;P&gt;However, i found if you set ‘copy local’ to False in the assembly references, the problem goes away. Of course, it does create another problem. How do you get the dll’s on sharepoint. &lt;/P&gt;
&lt;P&gt;The solution I’m going to take is: Create a feature that puts the DLL’s on the server. Create another feature that wants to use the dll’s, but has ‘copy local’ to false. I know, it’s not pretty, but it works. &lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;_Erwin&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9543793" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item><item><title>p&amp;p Sharepoint guidance v2</title><link>http://blogs.msdn.com/erwinvandervalk/archive/2009/03/20/p-p-sharepoint-guidance-v2.aspx</link><pubDate>Fri, 20 Mar 2009 06:30:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9491688</guid><dc:creator>erwinvandervalk</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/erwinvandervalk/comments/9491688.aspx</comments><wfw:commentRss>http://blogs.msdn.com/erwinvandervalk/commentrss.aspx?PostID=9491688</wfw:commentRss><description>&lt;p&gt;Since the Prism project is done, I’ll be working on a different project for the next couple of months. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeplex.com/spg" target="_blank"&gt;Sharepoint guidance on Codeplex&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The goal of this project is to provide guidance on how to build Sharepoint applications in a professional way. &lt;/p&gt;  &lt;h1&gt;Version 1 of Sharepoint Guidance&lt;/h1&gt;  &lt;p&gt;V1 of the Sharepoint guidance project focused mainly around the following aspects:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to work with development, testing and production environments. &lt;/li&gt;    &lt;li&gt;How to build sharepoint solutions in a Test Driven fashion. &lt;/li&gt;    &lt;li&gt;How to set up a Continious Integration environment, that does our Builds, and runs our Unit and Acceptance Tests &lt;/li&gt;    &lt;li&gt;How to build Sharepoint applications that can be versioned. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To do this, we’ve built a reference implementation that demonstrates all of these concepts. &lt;/p&gt;  &lt;h1&gt;Version 2 of Sharepoint Guidance&lt;/h1&gt;  &lt;p&gt;We are now well on our way with the Sharepoint Guidance and are already in iteration 6 (we have two week interations). &lt;/p&gt;  &lt;p&gt;In V2, we have the following goals:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to design and build content driven applications      &lt;ul&gt;       &lt;li&gt;How to develop an application that allows a mixture of development activities and authoring. &lt;/li&gt;        &lt;li&gt;How to create composite &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;How to extend existing LOB systems:      &lt;ul&gt;       &lt;li&gt;How to integrate LOB systems in a secure way using Single Sign-On (SSO) &lt;/li&gt;        &lt;li&gt;How to manage connectivity with LOB systems and databases by using the Business Data Catalog (BDC) and call Windows Communication Foundation (WCF) from Sharepoint.&amp;#160; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h1&gt;Sharepoint Guidance V2 – Drop 5&lt;/h1&gt;  &lt;p&gt;Last Friday, we’ve released drop 5 to codeplex. You can download it from here:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674" href="http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674"&gt;http://spg.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24674&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The most important things we have addressed in this drop are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;How to implement global navigation, across different site collections.&amp;#160; &lt;/li&gt;    &lt;li&gt;How to implement custom navigation. &lt;/li&gt;    &lt;li&gt;How to add Silverlight controls to your site. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/francischeung/" target="_blank"&gt;Francis cheung&lt;/a&gt; and I have created a webcast that guides you trough some of the things we did in drop 5:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:4e5e7126-f6e6-48c8-bf0a-f150632624fa" class="wlWriterEditableSmartContent"&gt;&lt;div id="8b7f6255-b9e3-4759-93cc-65fd089edc81" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://video.msn.com/video.aspx?vid=207890eb-f382-42bc-99cb-a3533435631c&amp;amp;from=writer" target="_new"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/video1850d7bd2463.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('8b7f6255-b9e3-4759-93cc-65fd089edc81'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;embed src=\&amp;quot;http://images.video.msn.com/flash/soapbox1_1.swf\&amp;quot; quality=\&amp;quot;high\&amp;quot; width=\&amp;quot;623\&amp;quot; height=\&amp;quot;524\&amp;quot; wmode=\&amp;quot;transparent\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; pluginspage=\&amp;quot;http://macromedia.com/go/getflashplayer\&amp;quot; flashvars=\&amp;quot;c=v&amp;amp;v=207890eb-f382-42bc-99cb-a3533435631c&amp;amp;from=writer&amp;amp;mkt=en-US\&amp;quot; &amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h1&gt;Global navigation&lt;/h1&gt;  &lt;p&gt;In our reference implementation, we’re demonstrating how to create consistent navigation across different sites and site collections. It’s very simple to create a sitemap for a single site, by creating a sitemap.xml and using the asp.net sitemap control to create the sitemap and add it to your site. However, creating a sitemap that’s shared between all sites is a bit harder.&lt;/p&gt;  &lt;p&gt;The structure of our reference implementation is as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_thumb.png" width="532" height="332" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We have a sitecollection for our intranet site, a sitecollection for our extranet site and a sitecollection for partner specific sites. Partners who log on to their homepage, will likely navigate between pages on their site and pages on the extranet home, for example to view products or promotions. &lt;/p&gt;  &lt;p&gt;We want the global navigation structure to look somewhat like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/erwinvandervalk/WindowsLiveWriter/ppSharepointguidancev2_D219/image_thumb_1.png" width="495" height="274" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The partner should be able to seamlessly navigate between each part of our Sharepoint site. Of course, we only want to have the structure of our site stored and versioned in one place. So to create a consistent story across multiple pages, we have taken the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Created a Sharepoint deployment project to create a feature that will apply a masterpage (with the website’s branding). This masterpage also contains a sitemap control that points to the SPXmlContentMapProvider:      &lt;br /&gt;      &lt;div&gt;       &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;asp:SiteMapDataSource&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ShowStartingNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; 
    &lt;span style="color: #ff0000"&gt;StartingNodeUrl&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/pssportalroot&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;SiteMapProvider&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;SPXmlContentMapProvider&amp;quot;&lt;/span&gt; 
    &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;contosoPssSiteMap&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Create a Sitemap xml file that will be placed 12 hyve. To do that, you have to put it in the folder Templates\Layouts folder. 
    &lt;br /&gt;

    &lt;br /&gt;The sitemap xml looks like this: 

    &lt;br /&gt;

    &lt;div&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMap&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/pssportalroot&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Partner Home&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/_layouts/contoso/partnerredirect.aspx?page=Home&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Manage Incidents&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/_layouts/contoso/partnerredirect.aspx?page=incidents&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Product Catalog&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/productcatalog/category.aspx?categoryid=0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Promotions&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/promotions&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt; &lt;span style="color: #ff0000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Search&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;url&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;/sites/pssportal/search&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMapNode&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;siteMap&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;Create a featurereceiver to merge the sitemap xml fragment into sharepoints global sitemap. To do that, call the following method in the FeatureActivated method of the FeatureReceiver: 
    &lt;br /&gt;

    &lt;br /&gt;

    &lt;div&gt;
      &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;web.Site.WebApplication.Farm.Services.GetValue&amp;lt;SPWebService&amp;gt;()
    .ApplyApplicationContentToLocalServer();&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Custom sitemapprovider&lt;/h1&gt;

&lt;p&gt;We are also demonstrating how fill a sitemappath control with custom data and we are using the business data catalog for that. &lt;/p&gt;

&lt;p&gt;In our scenario, the business data catalog provides a list of categories and products (which it gets from WCF webservices in a different system). It then uses this data to create category and product pages to display the individual catalogs and products. &lt;/p&gt;

&lt;p&gt;We’ve created a custom sitemap provider that will retrieve the categories and url’s to the category pages from the BDC. We then tie a normal asp.net sitemappath control to that sitemap provider to display a ‘crumb’ path&amp;#160; that displays sitemap information. &lt;/p&gt;

&lt;h1&gt;Silverlight Controls&lt;/h1&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;In our reference implementation, we are also demonstrating how to add silverlight controls to your site. To a ‘normal’ asp.net webapplication, adding silverlight controls is really easy, because the IDE takes a lot of things out of your hands. In Sharepoint, unfortunately that’s not as easy. So if you want to use the Serverside Silverlight controls (in System.Web.Silverlight, from the Silverlight SDK), you will also need to have Asp.net Ajax support in your site. This means: Adding the required entries to the web.config and adding a scriptmanager control to your page. &lt;/p&gt;

&lt;h2&gt;Web.config changes&lt;/h2&gt;

&lt;p&gt;There are basically two ways to make changes to the web.config of a sharepoint server. Programmatically, through the API or declaratively, in a XML file. Since there are quite a few changes you have to make to your web.config, we figured the declarative approach works best. Again, you have to call ApplyApplicationContentToLocalServer() to merge the declarative changes into the web.config. I’ll write a later blogpost or do a webcast on how to do this in more detail.&amp;#160; But if you are interested, you can always look at our drop.&lt;/p&gt;

&lt;h2&gt;SafeScriptManager&lt;/h2&gt;

&lt;p&gt;The scriptmanager proved to be an issue. You can only have 1 scriptmanager on your page and it must appear before any controls that need it. Normally, you would add a scriptmanager to your masterpage and be done with it. However, sharepoint is quite dynamic with it’s masterpages. You can easily create a new masterpage and use it as the default masterpage for some group of pages. So this means that if you use ajax in some of your webparts, you can no longer use those webparts on pages that don’t have a scriptmanager. &lt;/p&gt;

&lt;p&gt;So we’ve created a control called the SafeScriptManager. You can safely add it to any controls or webpart that needs a scriptmanager. It will check if a scriptmanager is already present. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;I hope this clarifies a bit what we have done in this drop. I plan on doing a blog post and a webcast for each drop from now on. As always, any feedback (on the post, on the drop or on the weather) are welcome :)&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9491688" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/erwinvandervalk/archive/tags/Sharepoint/default.aspx">Sharepoint</category></item></channel></rss>