Mar 072011

SharePoint Guidance 2010


Microsoft patterns & best practices for SharePoint 2010

I found this SharePoint 2010 “framework” on codeplex which has been created by several MVP’s. It contains several patterns & best practices which help you best take advantage of the new capability’s of SharePoint 2010.

The website is Here you can find a large pdf e-book which explains all of the functionality the framework provides + some hands on labs and examples how to implement this into your projects.

At first it looks like a very high level framework but I think it will definitely give some added value to your SharePoint 2010 projects!

An example for this is the application setting manager:

The Application Setting Manager is a set of utility classes that you can use to store and retrieve configuration settings for your SharePoint applications. The Application Setting Manager provides a uniform, type-safe approach for managing configuration settings at the following levels of the SharePoint hierarchy.


Farm (SPFarm class)

Web application (SPWebApplication class)

Site collection (SPSite class)

Site (SPWeb class)


You can use the Application Setting Manager to store simple types, such as integers or strings, as well as more complex types that can be serialized to XML. The Application Setting Manager manages the serialization and deserialization of data types to and from XML.


The Application Setting Manager provides a hierarchical model for the storage and retrieval of configuration settings. This enables you to create an application setting at a broad scope (such as the farm level) and override that setting at a narrower scope (such as the site level). When you retrieve a setting, using a key string, the Application Setting Manager will first look for that key at the site (SPWeb) level of the current execution context.


If the configuration key is not found, the Application Setting Manager will look for the configuration setting at progressively broader scope, up to and including the farm level. For example, you could use the following code to locate a configuration setting of type DateTime, without knowing the level in the SharePoint hierarchy at which the setting is stored.


IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();

var config = serviceLocator.GetInstance();

DateTime timeApproved;

if (config.ContainsKey("approvedTime"))


timeApproved = config.GetByKey("approvedTime");


As illustrated by the code example, you are encouraged to use the SharePoint Service Locator to retrieve and instantiate instances of the interfaces provided by the Application Setting Manager.




Published: 3/7/2011  1:05 PM | 0  Comments | 0  Links to this post

Sep 022010

SharePoint 2010 : Sandboxed visual webpart is possible!


As probably many of you have been told it’s not possible to create a visual webpart within a sandboxed solution. I know when I heard this it was a real downside and didn’t really make me enthusiastic about using this kind of solution. But, there’s a spark on the horizon, some people have already figured out how to work around this drawback!


I first noticed the possibility when working with the SharePoint 2010 Dev tools for visual studio from Codeplex but their template just simply doesn’t work. Of course now my curiosity flared up and I kept looking until I came across this great blogpost by Stefan Stanev which explains step by step how to achieve a sandboxed visual webpart + gives a downloadable sample project (POC) .

Now this project probably won’t work immediately, it will build but will show error’s when you try adding the webpart because it has this post-build script (postbuild.ps1) which uses specific hard coded locations. Be sure to install the ILMerge tool (free Microsoft download here) to this location - C:\Program Files (x86)\Microsoft\ILMerge.


This sure got me thinking about sandboxed solutions again, hope it will convince you too!




Published: 9/2/2010  9:35 PM | 0  Comments | 0  Links to this post

Sep 012010

SharePoint Developer Tools for Visual Studio 2010


Found a handy new add-in for Visual Studio 2010 on CodePlex here called SharePoint Developer Tools for Visual Studio 2010. It’s a work in progress as I found out not all their templates are 100% but I think there are some useful and timesaving templates/features in there!




Published: 9/1/2010  7:42 PM | 0  Comments | 0  Links to this post

Jun 142010

Application pool password “recovery” possibility removed from SharePoint 2010


As some of you may know, in SharePoint 2007 it was possible to get the username & password for the application pool identity by deploying a webpart with a small piece of code as shown in Tobias Zimmergren's post here. This post showed us the need for running a least-privileged installation in SharePoint 2007 because this password was stored as plain text.


So I thought I’d try this out for SharePoint 2010 and what do you know, it doesn’t work anymore. Microsoft clearly saw this “bug” and resolved it by making sure the app.Password method can’t be called directly in code. If you need the password I think you’ll still be able to get it but not as plain text to be shown for the whole world to see.


If anyone does find a way around this and it’s still a bug, feel free to comment!




Published: 6/14/2010  3:38 PM | 0  Comments | 0  Links to this post

Jun 112010

Options for running 64-bit VPC (.vhd) from Windows 7 (non server OS).


If you’re working with SharePoint 2010 images you are aware that these need to run on a 64bit  system. Now the problem is that Microsoft’s own Virtual PC software does not support 64bit images, so Microsoft has Hyper-V for this (only available in Windows Server).


Now if you want to download and run SharePoint images provided by Microsoft they will have .vhd hard disks which run a 64bit OS and as not everyone is running a Windows Server instance on their machine you won’t have Hyper-V to run these.


Here are at least some of your options to get past this problem without installing Windows Server on your machine.


1. Converting your virtual hard disk


Now there are tools to convert .vhd disks to .vmdk and the other way around such as “StarWind V2V Image Converter”. So in our case you convert you’re .vhd file to a .vmdk file which you can then run with VMware player which does support 64-bit OS. I’ve tried this and it does work but it sure takes a long time, time you possibly don’t have…


2. Free 3rd party software that runs both .vhd and .vmdk and supports 64-bit OS.


I’ve now found a great piece of software called “VMLite Workstation” which is completely free and available for download after registration. This tool allows you to create virtual machines from almost any type of hard disk (.vhd - .vmdk - .vdi - .hdd) and multiple OS’s including 64-bit.


This way you just download the hard disks in .vhd format from Microsoft and create a new Virtual machine with VMLite and you’re working in 5 min’s!


Hope this saves you some time!




Published: 6/11/2010  2:44 PM | 0  Comments | 0  Links to this post