Archive for June, 2010

Simultaneous Editing in Office 2010 Web Apps: Only in Excel and OneNote

June 25, 2010

Thought that this was a Major feature for the Office 2010 Web Apps. But it did not make it in the final bits for PowerPoint and Word.

“Simultaneous editing for collaboration is one of the most hyped features in Office 2010, however it’s only supported over the web in the Excel 2010 web app.  For Word and PowerPoint simultaneous editing, you’ll need to have the full client versions of the Office 2010 products.  This will likely be a disappointment for people who were hoping to collaborate on documents from kiosks anywhere in the world.” (Michael Fettner)

Go over to his blog for the details.


Login troubles with Word and SharePoint?

June 23, 2010

Symptom: do users complain that they need to login over and over when opening and saving word documents on your SharePoint ( MOSS2007 /SP2010 ) portal?

Then you probably have used a FQDN for your portal url.

The fix is quite easy if you have Vista or Windows 7 clients:

Short version:

Add a reg key to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters”

with the name: AuthForwardServerList (MULTI_STRING) and add your portal urls as values:

Doing Unit Testing with TFS2010 and SP2010

June 22, 2010

SharePoint 2010 has a wonderfull new developers experience with Visual Studio 2010 and great integration with Team Foundation Server 2010. We configured our TFS Build server to build our SP2010 solutions fairly easy. Just make sure the SP2010 dll’s you reference in your SP2010 projects are available on the TFS Build Server (in the GAC makes it very easy).

But one thing is not possible, and that is using the Test Projects with your SP2010 projects. Why? because Microsoft did not implement testing with .Net framework 3.5 and below. You can only use the Test projects in VS2010 (and thus in TFS2010) with 4.0 Framework projects. And so you cannot use the Unit test in VS2010 either.

But you can fairly easy use the Nunit 2 framework with VS2010 and TFS2010. Head over to this codeplex project: and you can now have 3.5 Framework NUnit tests with TFS2010. And your Unittest results even show up in TFS2010 build reports!

So how to get NUnit to test your SP2010 projects? Install SP2010 on your TFS Build Agent! You can then deploy your solutions on the build server, perform unit tests, and then remove your solutions again.

Individual test results:

So what do you need:

– VS 2010 solution with one or more SP2010 projects and at least one NUnit Test project
– TFS Build Agent with SP2010 installed and configured
– A web application for this solution we want to build ( store the web application url in your tfsbuild.proj )
– a deployment script ( powershell off course ) that can be used on you dev server, the Build Agent server (farm) and other farms
– a removal script ( powershell also ) that clears your deployment again
– a tfsbuild.proj that builds, packages and runs the nunit ( see below )
– XSLT to transform NUnit test results to MSTest test results

A powershell script to deploy a solution can be found here
So here is a small overview of my tfsbuild.proj:

– build the solution/projects
– package the projects that are sp2010 projects ( this makes the wsp packages ! )
– run a powershell deployment script
– run nunit against your test project
– run a powershell removal script
– convert the nunit result xml to TFS / MSTest format with xslt ( see codeplex link above )
– upload the nunit transformed test results to tfs with MSTest
– zip the solutions with the scripts
– upload the zip to a location where you can use it on the test environment

Example NUnit code:

        public void TestFeatures() {
            Assert.IsNotNull(this.projectName, "No valid ProjectName found.");
            Assert.IsNotNull(this.webapp, "No valid Test WebApplication is found.");
            Assert.IsNotNull(this.testsite, "No valid Test Site Collection is found.");

            try {
                //string contenttypes_id = "03ec908f-fc7a-44cf-a8fc-bc3b9d9896de";
                //string trefwoorden_id = "f0455e8e-aa5d-4ae7-8af9-a97947f7e3a0";
                string webparts_id = "f0e1d4d6-2694-479f-8751-9704818f1464";

                SPFeature feature = this.testsite.Features[new Guid(webparts_id)];
                Assert.IsNotNull(feature, "webparts_feature not found active.");

                // check if the webparts are present in the WebPart Gallery

            catch (Exception exc) {

You can download exmple scripts and proj files here:
Codeplex “release” for this blog

Document ID Provider, the last one?

June 21, 2010

For a client of ours we wanted to create a Custom SP2010 Document ID Provider. For this provider I wanted to be able to adjust and configure it so I can use it for other customers also.
First I needed to know how to create a Document ID Provider and found that: Tobias Zimmergren had an excelent article on creating you own SP2010 Document ID Provider.

Next in order to create a unique sequenced number I immediatly thought of SQL Server. And found that Ton Stegeman had an equally usefull post on how to create your own SPDatabase object in a SharePoint Farm.

Now I was set to create “the last Document ID Provider” for SP2010 I was ever going to write. Perhaps not but still, it should suffice for a LOT of clients of us!

I wanted to end up with an admin page like this:

This should then result in this document id:

So how to do this?
Step 1
Create a Database with a Table where I can store my generated document id’s

CREATE TABLE [dbo].[scoped_docid](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[scopeid] [uniqueidentifier] NOT NULL,
	[objectid] [uniqueidentifier] NOT NULL,
	[scopedocid] [bigint] NULL,
	[scope] [varchar](100) NULL,
	[generateddocid] [varchar](150) NULL,
	[listid] [uniqueidentifier] NULL,
	[webid] [uniqueidentifier] NULL,
	[siteid] [uniqueidentifier] NULL,
	[webapplicationid] [uniqueidentifier] NULL,
	[farmid] [uniqueidentifier] NULL,
	[created] [datetime] NULL,
	[id] ASC

And a stored procedure to Get/Insert ID’s:

-- =============================================
-- Author:		Stef van Hooijdonk
-- Create date: juni 2010
-- Description:
-- =============================================
	-- Add the parameters for the stored procedure here

	@scopeid uniqueidentifier  ,
	@scope varchar(100),
	@itemid uniqueidentifier
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.


	declare @result bigint
	declare @scopedindex bigint

	select @scopedindex=COALESCE([scopedocid],-1),@result=[id] from scoped_docid where [objectid] = lower(@itemid)

	if (@scopedindex is null)  begin
		-- coalesce for the first record will have MAX = null, and then we add 1
		select @scopedindex=COALESCE(MAX(scopedocid),0)+1 from scoped_docid where scope = lower(@scope)

		insert into [scoped_docid] (scopeid ,scope,objectid, scopedocid ) values( lower(@scopeid), lower(@scope),LOWER( @itemid), @scopedindex)
		select @result = SCOPE_IDENTITY()
	select @result as record,@scopedindex as docid

There is more to it than this, but you can check out the downloads for all the details.
Step 2
Create an SPDatabase object for this Database, see the Ton Stegeman post!

Step 3
Create a Document ID Provider that uses this SPDatabase and generates Document ID’s based on some settings. What I did was generate the sequenced number in SQL and then format that in a method with the other variables. Generating a YEAR or DAY into a string is fairly easy.

Step 4
Create an Central Admin page to change the settings of our Document ID Provider ( see screenshot ).
You can use the SPFarm.Local.Properties to score your settings Farm Wide:

/// <summary>
/// The default farm wide scope setting for this DocumentProvider
/// </summary>
public ProviderScope Scope {
  get {
    ProviderScope result = ProviderScope.Farm;
    try {
      string setting = Settings.GetFarmSetting("CustomDocumentIDProvider.Scope");
      if (!string.IsNullOrEmpty(setting))
        result = (ProviderScope)Enum.Parse(typeof(ProviderScope), setting);
    catch (Exception exc) {
    return result;
  set {
    Settings.SetFarmSetting("CustomDocumentIDProvider.Scope", value.ToString());

The scope:

/// <summary>
/// Scopes for the Document ID Provider
/// </summary>
public enum ProviderScope {
	/// <summary>Farm wide scope</summary>
        /// <summary>Webapplication scope</summary>
        Webapplication = 2,
        /// <summary>SPSite/Site collection scope</summary>
        SiteCollection = 3,
        /// <summary>Site/Subweb (SPWeb) scope</summary>
        Site = 4,
        /// <summary>List scope</summary>
        List = 5,
        /// <summary>No scope</summary>
        None = 100

Download solution
Download sources

How to use the solution

Small Powershell scripting tip

June 16, 2010

Want to log the output of your powershell script?
use “Start-Transcript”!

Top of your powershell script:

## Start logging
$LogTime = Get-Date -Format yyyy-MM-dd_h-mm
$LogFile = "$env:USERPROFILE\Desktop\Deploy-$LogTime.rtf"
Start-Transcript -Path $LogFile -Force

and put this at the end of your script:

Invoke-Item $LogFile

iPhone and SharePoint

June 4, 2010

Want SharePoint on your iPhone?
Moshare for the iPhone is available for free now in the App Store.