SharePoint 4 Developers

Additional reference guide in .NET / SharePoint Development

Value does not fall within the expected range

Value does not fall within the expected range. I have decided to create this post to alert developers about this.

Hi folks,

This week I faced an error that was a real pain, and because of that I decided to create this post. To alert others about this.

I was developing a Silverlight Application in SharePoint and all of a sudden started getting the error message: Value does not fall within the expected range.

As I am using the Silverlight Object Model, I decided to see more details about this error through Fiddler. I got this:

Figure 1 – Fiddler analysis

It simply didn’t help at all. Really hard to identify what it is. Sad smile


In a different environment the same code was working perfectly fine, so I eliminated any issues with the code.

Luckily (or not), by checking the Lists I found this error message in my view:

This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.

In order to solve this “other” issue I was obliged to set the Resource Throttling value up for “List View Lookup Threshold”.

Go to the Central Admin > Application Management > Manage web applications

Figure 2 – Manage web applications

Select the web application that needs to be changed, and then go to General Settings > Resource Throttling

Figure 3 – Resource Throttling

Increase the value of the List View Lookup Threshold, according to the Figure 4:

Figure 4 – List View Lookup Threshold

By saving this change, when I got back to the List, the error message disappeared and hence the issue with application was eliminated! My application just worked fine! Smile


Because of the business requirements in my solution, the threshold needed to be increased.

Always evaluate the impact of changing default threshold values in SharePoint.

Be aware of the amount of columns in your Lists. This threshold affects Lookup, Person/Group and Workflow Status fields.

I hope it helps.



Marcel Medina

Click here to read the same content in Portuguese.

Silverlight SharePoint Web Parts

A new Visual Studio 2010 Extension was released recently, which installs Silverlight Web Part templates for SharePoint 2010, called Silverlight SharePoint Web Parts.

Hi folks,

A new Visual Studio 2010 Extension was released by Paul Stubbs recently, which installs Silverlight Web Part templates for SharePoint 2010, called Silverlight SharePoint Web Parts.

The task of creating Silverlight Web Parts is a little bit tricky, because of the required settings to be set against projects in Visual Studio, as you can check at:

The nice thing about this new extension is that it takes advantage of SharePoint 2010 Power Tools to create Visual Web Parts in the Sandbox.


1) Install the extension Visual Studio 2010 SharePoint Power Tools.

Figures 1,2,3 – Installation screenshots of the Visual Studio 2010 SharePoint Power Tools extension

2) Install the extension Silverlight SharePoint Web Parts.

Figures 4,5 – Installation screenshots of the Silverlight SharePoint Web Parts extension

3) Open up the Visual Studio and check if the extensions are available. Go to Tools > Extension Manager:

Figure 6 – Extension Manager of Visual Studio 2010

New Templates

Just as a demo, let’s create an example of each new template and them make some comparisons. Something very simple like a Hello World. Follow the steps below:

1) Create 2 new Silverlight Application projects. Name them as HelloWorld1 and HelloWorld2:

Figure 7 – Creating a Silverlight Application

Figure 8 – Silverlight 4

Note: Do the same for Hello World 2.

The solution should look like this:

Figure 9 – Hello World projects


2) Add the XAML code snippet on the pages MainPage.xaml of both projects:

Code Snippet
  1. <TextBlock Text="Hello World 1!" />


The final XAML should look like this:

Code Snippet
  1. <UserControl x:Class="HelloWorld1.MainPage"
  2.    xmlns=""
  3.    xmlns:x=""
  4.    xmlns:d=""
  5.    xmlns:mc=""
  6.    mc:Ignorable="d">
  8.     <TextBlock Text="Hello World 1!" />
  9. </UserControl>


3) Add 2 new Empty SharePoint Projects to the solution. The first one called SilverlightWebPart (Figure 10) and the second one called SilverlightCustomWebPart:

Figure 10 – Empty SharePoint Project

So far our solution should look like this:

Figura 11 – Projetos adicionados

4) For each new added project, Web Parts will be included.

To begin add a Silverlight Web Part to the SilverlightWebPart project. Name it SilverlightWP (Figure 13).

Then select a Silverlight Custom Web Part, which is a Visual Web Part to be hosted in the sandbox. Add it to the SilverlightCustomWebPart project and name it SilverlightCustomWP.

Figure 12 – New templates

Figure 13 – Adding a Web Part

Due to the fact we have more than one Silverlight project, the extension displays a popup to select it according to the Figure 14:

Figure 14 – Selecting a Silverlight project

Note: Select HelloWorld1 for SilverlightWebPart and HelloWorld2 for SilverlightCustomWebPart.

If we had one single Silverlight project, the popup wouldn’t be displayed and an automatic reference to the Silverlight project would be added.

Final Solution

The final result in both Silverlight Web Part projects is the creation of SharePoint Modules, which deploys xap files in the Master Page Gallery, Web Parts in the Web Part Gallery and pages against the Library SitePages.

The main difference of the SilverlightCustomWebPart project is the creation of a UserControl to host the xap file. This is interesting because it allows us to customise the UserControl so we can write javascript to integrate with the Silverlight application.

Check out the final solution:

Figure 15 – Final Solution

Here you get the results:

Figures 16 and 17 – Silverlight Web Parts



Marcel Medina

Click here to read the same content in Portuguese.

CopyToClipboard Feature - Codeplex

This is a SharePoint 2010 Feature that adds a button in the Ribbon, allowing users to copy document urls (links) to clipboard.

Hi folks,

Finally I have decided to make a contribution to the Open Source world, by creating a SharePoint 2010 Feature.

This feature was created to assist users in copying document urls (links) and pasting them into e-mails and documents. It is called CopyToClipboard and allows users to perform this action without trouble.

Basically the Feature is a Custom Action that adds a button in the Ribbon. The solution contains Xml configuration files + ECMAScript (Client Object Model) + JQuery.

I would like to disclose this Feature to everybody. In regards to the technical approach, it definitely deserves an exclusive article, which I expect to let it available soon.

Deploy it in your environment and announce to the users. The project download and more details are available in the following link:



Marcel Medina

Click here to read the same content in Portuguese.