Archive

Author Archive

First NEN 2082 certified project with SharePoint 2010

March 4th, 2010 Jeffrey Tummers No comments


Together with 3 colleagues from QNH Business Integration I am currently finishing implementing a already NEN 2082 certified project based on SharePoint 2010.
When SharePoint 2010 hits RTM there will be another audit for this version of SharePoint, because currently the pre release version has been certified.

NEN 2082 is a Dutch standard which is similar the DoD5015 and MoReq standards.

This project was done for the Gemeente Nieuwegein, which is a Dutch local Government.

Gemeente Nieuwegein

For this project we have also been nominated for the “Innovation of the year” award:

LRG Innovator Nomination 2010

More information (Dutch)

My colleagues at QNH:

Bookmark and Share
Categories: SharePoint Tags: , ,

Problem with VS2010 beta 2 Site Definition

December 16th, 2009 Jeffrey Tummers 3 comments

I encountered the following problem while creating a new custom Site Definition in Visual Studio 2010 beta 2.

The problem occurs when trying to create a new Document Library in the site based on the custom Site Definition.

Error while trying to add a new Document Library

Error while trying to add a new Document Library

Error message:

Error

An error occurred while getting items from the "" provider:
Cannot complete this action.

Please try again.

Read on to see the solution for this error.

Visual Studio 2010 now has native integration of SharePoint 2010 projects.

New Site Definition in Visual Studio 2010

New Site Definition in Visual Studio 2010

After creating the new Site Definition Project in the onet.xml file contains the following:

<?xml version="1.0" encoding="utf-8"?>
<Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
  <NavBars>
  </NavBars>
  <Configurations>
    <Configuration ID="0" Name="SampleSiteDefinition">
      <Lists/>
      <SiteFeatures>
      </SiteFeatures>
      <WebFeatures>
      </WebFeatures>
      <Modules>
        <Module Name="DefaultBlank" />
      </Modules>
    </Configuration>
  </Configurations>
  <Modules>
    <Module Name="DefaultBlank" Url="" Path="">
      <File Url="default.aspx">
      </File>
    </Module>
  </Modules>
</Project>

Now you can modify to the onet.xml and default.aspx as you like.

When deploying the new Site Definition, creating a site, and then trying to create a new Document Library you get the error above.  The solution for the error turned out to be the missing declaration of the <DocumentTemplates> XML node.

Correct default onet.xml should be:

<?xml version="1.0" encoding="utf-8"?>
<Project Title="SampleSiteDefinition" Revision="2" ListDir="" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/">
  <NavBars>
  </NavBars>
  <DocumentTemplates>
  </DocumentTemplates>
  <Configurations>
      <Lists/>
      <SiteFeatures>
      </SiteFeatures>
      <WebFeatures>
      </WebFeatures>
      <Modules>
        <Module Name="DefaultBlank" />
      </Modules>
    </Configuration>
  </Configurations>
  <Modules>
    <Module Name="DefaultBlank" Url="" Path="">
      <File Url="default.aspx">
      </File>
    </Module>
  </Modules>
</Project>

After re-deploying the Site Definition and creating a new Site, you are able to create a Document Library.

Working new Document Library

Working new Document Library

Reference:

Microsoft’s Reference for SharePoint 2010 onet.xml

Bookmark and Share

Looking for SharePoint 2010 Feature (GU)IDs

December 15th, 2009 Jeffrey Tummers 1 comment

Have you ever been looking for a feature (GU)ID in SharePoint? Well here is an easy way to find them.

I needed default SharePoint feature guids for the development of a custom Site Definition. Using a custom Site Definition you can automatically activate SharePoint features within the onet.xml file.

Here we go:

  1. Open the SharePoint site in IE8 (or IE7).
  2. Go to the Site Settings page.
    site-settings-menu
  3. Click on the Manage Site features (or Site Collection features)
    site-features
  4. Use the Developer Tools (shortcut F12)
  5. Click in the toolbar on Find –> Select Element by Click (shortcut CTRL+B, but this opens bookmarks manager on my machine)
    developertools-select
  6. Select the Activate (or Deactivate) button next to the feature you need the GUID from.
    select-feature-activate-button
  7. Developer Tools scrolls down to the HTML source for the specific button, the button tag is contained within a Div tag. This Div tag contains an ID attribute and thats the GUID for the feature!
    selected-feature-html
  8. In this case the GUID is: 9c03e124-eef7-4dc6-b5eb-86ccd207cb87
    selected-feature-guid

This trick also works for SharePoint 2007!

Bookmark and Share

C# 4.0 .NET becomes dynamic

May 29th, 2009 Jeffrey Tummers No comments

This post is about the session called C# 4.0 / The Future of C# given by Krishnan Subramanian.

csharp4-dlr

First off let me start with a quick summary of main new feauture for the different versions of the C# that are released.

  • C# 1.0, Managed code
  • C# 2.0, Generics
  • C# 3.0, Language Integrated Query, short LINQ
  • C# 4.0, Dynamic programming

Some off the innovation for C# 4.0 are:

Dynamic Language Runtime
The new version of C# has a new type of object declaration, called dynamic. This looks a bit the var keyword. With the var keyword the compiler replaced the var with the object type on compile time, intellisense and code completion still was available in Visual Studio. With the new dynamic keyword the compiler doesn’t replace this and even more important the compiler can’t check for syntax error on a dynamic object. Intellisense and code complition are also not available for objects defined with dynamic.

Dynamic objects are losely typed instead of strongly.

After reading this you might think whats the use of this new DLR, in the following sample I’ll try to explain this. We have a simple C# class called Calculator, and use it like below.

Calculator calc = GetCalculator();
int sum = calc.Add(10, 20);

Now suppose the calculator class is not strongly typed, the code would like something like the following

object calc = GetCalculator();
Type calcType = calc.GetType();
object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 });
int sum = Convert.ToInt32(res);

With the new dynamic keyword in C# 4.0 it would simply be

dynamic calc = GetCalculator();
int sum = calc.Add(10, 20);

Optional Named Parameters
To show you the what this means take a look at the examples below.

In previous version of C# method overloads would be used.

public void Add(string lineOfText);
public void Add(string lineOfText, bool isError);
public void Add(string lineOfText, int repeat);
public void Add(string lineOfText, int repeat, bool isError);

With the new C# 4.0, the method declaration would like this

public void Add(string lineOfText, int repeat = 1, bool isError = false);

As you can see in the sample above, it’s now possible to specify default values for a method parameter. Some samples of how to use the Add method are:

Add("This is the line", repeat : 5);
Add(isError : true, lineOfText : "Another line of text");

For people using JavaScript this might look very familiar.

Another cewl new thing I saw at the demo, was the ability to interpret and compile a string of C# code at runtime. This functionality offers some great new possibilities. Again for the Javascript people reading this it’s like the eval function.

Bookmark and Share
Categories: DevDays09 Tags: , ,

Silverlight 3 Validation and Dataform control

May 28th, 2009 Jeffrey Tummers No comments

This post is about the session calledWhat’s new in Silverlight 3 given by Mike Taulty.

Silverlight 3 has a new way for validating data. The validation rules can be set in a number of different ways:

  • Throwing an exception
  • Adding specific attributes to the classes properties

I specifically like the way the business rules can be applied to an object. Some samples of specifying the validation are shown below.

class Person
{
[Required(ErrorMessage = “The name of the person is required”)]
public string Name { get; set; }

[Range(18, 65, ErrorMessage = ”The person must be between 18 and 65 years old”)]
[DefaultValue(20)]
public int Age { get; set; }
}

More validation attributes are available at MSDN

The nice thing about the new version of Silverlight 3 is that the default input controls can handle these validation errors and show them to the user, this is very similar to the way we know validation controls in ASP.NET. The way in which these messages are shown is fully customizable through themes.

sl3_dataform

The screenshot above shows an example of the new Dataform which is also available in Silverlight 3. It also gives you an example of the standard way a user is informed about errors.

With the new Dataform control it is possible to automatically render the CRUD GUI for an object or list of objects.

By implementing the IEditableObject interface for an object, the following events can be handled within the class: BeginEdit, CancelEdit and EndEdit

For more information about the Dataform control see the following blog post of Mike Taulty, another post by Mike Taulty is about data validation

Bookmark and Share
Categories: DevDays09 Tags: , ,