SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: June 2012

SharePoint Max Dragon – checks for capacity planning limits

We decided to rename the Maxer tool ( ) to the SharePoint Max Dragon, for the reasons discussed at You can get it here:

The TechNet Wiki interview with Margriet

Read the Monday interview with Wiki Ninjette Margriet at Check out the “Iris and the Little Moon Bear” drawing!

How about Documents and Metadata using SharePoint 2010?

What do I do with Metadata and Documents? Is it possible to inherit Metadata?  Do I use Folders or Document Sets? This blog post provides the answers to these questions.

Folders & Metadata

It is possible to set default Metadata for every folder in your Document Library. You can set defaults on all of the subfolders from the root, by default this will be inherited.

Follow the next steps to do this:

  1. First you have to create the folders  and columns you want.
  2. Go to the Document Library
  3. Go to Library Settings
  4. Click Column default value settings (General settings)
  5. Select the folder (left) where you want to set a default
  6. Select the column that you want to use
  7. Set the default value for the column > click OK


That’s all! If you upload a document in the folder where you have set a default Metadata value, this value will be automatically filled.

Note: More information about SharePoint 2010 Best Practices Folders can be found at

Document Sets & Metadata

If you have multiple documents that are part of a single project or tasks you can use a Document Set. With Document Sets you can group ,multiple documents and share the Metadata en versioning. In a Document Set you can pass Metadata from the Document Set to the documents in the Document Set.

Follow the next steps if you want to use Document Sets. First you have to enable Documents Sets in the site collection:

  1. Go to Site Actions
  2. Go to Site Settings
  3. Go to Site Collection Features
  4. Click Document Sets

Note: Take a look at the following page if you want more information about which feature you need to activate:

After activating the Documents Sets site collection feature you can use Documents Sets in your Document Libraries

  1. Create a Document Library
  2. Go to Library Settings
  3. Go to Advanced Settings
  4. Allow management of content types > click OK
  5. Go to Add from existing site content types
  6. Add Document Set > click OK
  7. Go the the Document Library
  8. Click Documents
  9. Click New Document Set


Via the Document Set Settings page you can select which column values from the Document Set  should be automatically synchronized to all documents in the Document Set.

  1. Go to the Document Library
  2. Go to Library Settings
  3. Click Document Set (Content Types)
  4. Click Document Set settings


If you upload a document (or multiple) into the Document Set you will notice that the column values are synchronized.

Why is SPListItemCollection.Count so slow?

There are situations where people experience disastrous response times when trying to count the number of items in a collection or folder. Why does this happen? A long time ago, we wrote about this at . Basically, looping thru a collection and calling the Count property leads to a huge amount of SQL queries that are fired, resulting in a disappointing performance.

The best thing you can do in such a situation is establish what happens under the covers, and take actions accordingly. Usually, people advise to do this using SQL Server Profiler, which works fine for dev scenarios, but isn’t recommendable (because of performance reasons) in a production environment. Instead, you’d be better of executing a SQL DMV query that identifies the currently running SQL queries. Such as this one:


SELECT er.session_Id AS [Spid] , sp.ecid , DB_NAME(sp.dbid) AS [Database] , sp.nt_username , er.status , er.wait_type , SUBSTRING (qt.text, (er.statement_start_offset/2) + 1, ((CASE WHEN er.statement_end_offset = -1 THEN LEN(CONVERT(NVARCHAR(MAX), qt.text)) * 2 ELSE er.statement_end_offset END – er.statement_start_offset)/2) + 1) AS [Individual Query] , qt.text AS [Parent Query] , sp.program_name , sp.Hostname , sp.nt_domain , er.start_time

FROM sys.dm_exec_requests er

INNER JOIN sys.sysprocesses sp ON er.session_id = sp.spid

CROSS APPLY sys.dm_exec_sql_text(er.sql_handle)as qt

WHERE session_Id > 50

AND session_Id NOT IN (@@SPID)

ORDER BY session_Id, ecid

SQL DMV query techniques are discussed in the excellent book . We were technical reviewers for this book, and will devote a separate blog post to this book, but if you’re interested, check it out.

The Wiki Ninjette

The Top 10 TN Wiki ninja’s page is always great fun: Margriet’s activities of last week led to the one and only TN Wiki Ninja stick figure:

SQL Server MVP Deep Dives

Frequently, we act as technical reviewers for IT books. Now and then we devote a blog post to discuss one of these books. Today, we’re discussing SQL Server MVP Deep Dives Volume 2: It’s the most congenial IT book we ever saw, since the authors donate their proceeds to The book is written by an impressive number of SQL Server MVPs (we believe approx. 60 of them) and each one donates a chapter of around 10 pages long. Therefore, it reads more like a bundled collection of blog posts than a book, but you’re bound to learn something from it. One comment we’ve heard quite often that it is a very good read while travelling (a result of the diverse and short chapters).

Enabling the workflow DSL for a custom acitivity

Here’s a small trick for enabling the workflow DSL for a custom activity:

  1. First, create a new empty SharePoint project.
  2. Add a  reference to the System.Workflow.Activities assembly. It’s located in the GAC, and therefore it may be a bit of a hassle to reference it. For cases like these, we like to use Muse.VSExtensions ( ) from the Visual Studio gallery. It adds a new menu option called Add GAC Reference that allows you to search for and reference assemblies in the GAC directly. If that’s not enough, it also adds a menu option that removes unused references. It’s a great tool, that works like a charm.
  3. Also add a reference to System.Workflow.ComponentModel.dll, also located in the GAC.
  4. Add a new class: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Workflow.Activities;

namespace SharePointProject1
    public partial class Class1 : SequenceActivity
        public Class1()

Finally, add another class called class1.designer.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharePointProject1
    public partial class Class1
        private void InitializeComponent()
        { }

Now, when you click class1, you’ll find that now you can drag n drop activities. See for more info.