Archive for November, 2008

How To: Custom Web Part Properties (ToolPart)

November 29th, 2008 by Tobias Zimmergren

I’ve been getting a few requests from people who basically want to know how you can modify the Web Part Properties window – and foremost add your own logic and controls there.


  • SharePoint 101 basic knowledge
  • Knowledge about how you build and deploy Web Parts in SharePoint
  • (Really, you can just download the entire project in the end of this article and skip the pre-reqs.)


I will walk you through how you can add your own custom controls in the Web Part property pane, instead of relying on the standard controls.

Sometimes you’re just required to have a bit more advanced controls put in place which the default functionality can’t deliver. That’s where the ToolPart comes in handy!

In this case the ToolPart will do a lookup and see what Lists (SPListCollection) exists on the current site, and populate a simple DropDownList with the values.

Important note
I havn’t fully implemented the properties etc. in this Web Part in a manner you would preferbly do it – I’m simply focusing on the topic of the custom toolpart.


Default property pane (in this case, ListViewWebPart for Contacts)

Custom ToolPart pane with custom logic for the controls

Example of using the Web Part properties in the Web Part


  • Launch Visual Studio (2008 in my case)
  • Create a new Web Part in your preferred way (I actually used the Extensions for WSS for once..)
  • WebPart1.cs Add the properties you want to your webpart
  • public string Property1
             return _property1;
             _property1 = value;
    string _property1;
    public string Property2
             return _property2;
             _property2 = value;
    string _property2;

  • WebPart1.cs Override the Render()-method in order to simply output the properties we just created
  • protected override void Render(HtmlTextWriter writer)

  • WebPart1.cs Override the GetToolParts()-method in order to alter the toolpane
  • public override ToolPart[] GetToolParts()
        ToolPart[] allToolParts = new ToolPart[3];
        WebPartToolPart standardToolParts = new WebPartToolPart();
        CustomPropertyToolPart customToolParts = new CustomPropertyToolPart(); 

        allToolParts[0] = standardToolParts;
        allToolParts[1] = customToolParts;
        allToolParts[2] = new CustomToolPart(); 

        return allToolParts;

What we’re doing here is firstly instantiating the WebPartToolPart class which gives us the standard toolpart. Next we’re adding the CustompropertyToolPart which adds a custom property toolpart. Finally we’re adding our CustomToolPart to the collection of ToolParts and then we’re returning the collection – telling SharePoint that this is how we want it to render!

  • CustomToolPart.cs Create a new class called CustomToolPart and derive from Microsoft.SharePoint.WebPartPages.ToolPart
  • public class CustomToolPart : Microsoft.SharePoint.WebPartPages.ToolPart
            DropDownList ddl;
            Panel toolPartPanel;
            TextBox tb; 

            protected override void CreateChildControls()
                toolPartPanel = new Panel();
                ddl = new DropDownList();
                ddl.ID = "ddl"; 

                // Simply getting the lists of the current web, and displaying them in the dropdown-list.
                SPListCollection lists = SPContext.Current.Web.Lists;
                foreach (SPList list in lists)

                tb = new TextBox();
                tb.ID = "tb"; 


            public override void ApplyChanges()
                WebPart1 wp = (WebPart1)this.ParentToolPane.SelectedWebPart;
                wp.Property1 = ddl.SelectedValue;
                wp.Property2 = tb.Text;

The only noteworthy thing in this class is the override of ApplyChanges which basically tells our WebPart (this.PartenToolPane.SelectedWebPart is WebPart1) that it should set it’s properties to the values in the custom property toolpart we’ve created.

Summary & Download

That was easy enough – this was just a really swift intro to how you can manage your own controls and behaviour for your webparts properties.

You may download the VS2008 project here.


I can (Windows) Azure you – Song

November 28th, 2008 by Tobias Zimmergren

Okay, so I’ve been writing up a simple song the last week, which I just recorded with my laptop-microphone at the same time that I tried to do some tricks with the guitar… It all ended up with a song called “I can (Windows) Azure you”.

You can download the song here

Being a serious guy and all, please don’t take the song too serious ;-)

However! You may do cool remixes if you’d like, just let me know because they couldn’t possibly get any worse than this! :-)

Have a good weekend all!


Sweden SharePoint User Group presentations

November 26th, 2008 by Tobias Zimmergren

You’ll find the presentations from the UG meeting here;

I’m still waiting for access to the site from Daniel. Before I get that access I’m afraid I can’t do any real admin-stuff as we’ve discussed..

For any issues, questions, proposals, ideas or other thoughts regarding the User Group – mail me using the contactform under “contact”.


Sweden SharePoint User Group – First meeting done

November 20th, 2008 by Tobias Zimmergren

We had our first meeting this tuesday (November 18th) with about 30 people showing up. The interest is growing for the group, and as it looks now there’ll be more people coming to the next set of meetings. Fun!

Thanks to everyone who contributed to the meeting taking place.

In the picture I’m doing a presentation on what’s new and hot in the SharePoint world. And it looks like I’m trying to fly out from there with my left arm…

All in all, it was a great evening!

Hope to see you around!


Microsoft Office Systems 2007 – Service Pack 2

November 16th, 2008 by Tobias Zimmergren

Recent announcements around the blog-o-sphere and the announcements at TechEd in Barcelona indicated that the SP2 for Office Systems 2007 is on it’s way.


Don’t even bother to try to get an exact date for your upgrade. As it is said today, the SP2 for Microsoft Office Systems 2007 will be released somewhere between February and April 2009.
If you are to take SP2 into consideration, I would go for the latter timescope (April/May) to be sure :-)


As announced by the Office Service Pack Team:

Improved Outlook Calendaring Reliability

Improved Outlook Performance

Enabling Object Model support for Charts in PowerPoint and Word

Improved cryptographic functionality by supporting all cryptographic algorithms offered by the operating system

Improved functionality in Excel’s charting mechanism

Ability to ungroup SmartArt graphics (and as a result, the ability to add animations to them in PowerPoint)

Ability for Visio to export UML models to an XML file compliant with the XMI standard

Tool that enables the uninstall of Office client Service Packs


As per the Microsoft SharePoint Team Blog, the following parts are some of the SharePoint-related things that will be taken care of:

Improved Read-only Content Databases
Whenever a content database is marked read-only, all of the site collections in that database are automatically marked as read-only. 

ECM Performance and Manageability Improvements
Improved performance and manageability in variations, including STSADM commands for repairing links between source and target pages.

Improved Index Rebuild Timer Jobs
SharePoint content databases running in SQL Server 2005 will undergo an automatic index rebuild, which helps stop defragmentation, and stop the database from degrading in performance.

Upgrade Checker
This will scan your SharePoint farm in advance of applying SP2 and will provide feedback on the environments readiness to upgrade.


I do hope to see some more in-depth details as to what exact improvements are being made regarding the read-only content databases!

Regarding the Upgrade Checker, I think it’s something that should have existed for every SP and KB/Patch you install. Kind of like the “Windows Vista Upgrade Advisor”, but for SharePoint!

More info will be published about SP2 when it’s announced, stay tuned!

MSDN Ramp Up – Free training online

November 16th, 2008 by Tobias Zimmergren

If you are looking for some free training within any of the many Microsoft technologies, have a look at MSDN’s Ramp Up site. It’s a free community-based learning program where you can choose the training that fits your needs.

Ramp Up overview

These are the different tracks you can currently choose from;

SharePoint for developers track – Part 1

Well, foremost since there’s a new “SharePoint for developers” track availible here


This is a great way to improve your current skillset by adding some additional SharePoint skills (if you don’t have them already). It’s really easy to make this happen in your own pace.

This is the current set of levels in the SharePoint track part1:

  • Level 1: Web Parts
  • Level 2: Data Lists
  • Level 3: Event Handlers
  • Level 4: Workflow
  • Level 5: Silverlight

Sweden SharePoint User Group – November 18

November 15th, 2008 by Tobias Zimmergren

We’re going to have our first User Group with Sweden SharePoint User Group on Tuesday, November 18.

Anyone can register and attend the meeting, as long as you sign up here!

I will be presenting some highlights (at least what I found interesting in my SharePointer-eye) from TechEd Developers – which is also a recap of what was said at the PDC conference!

I hope to see you there!


Leaving for TechEd EMEA 2008 – Developers

November 9th, 2008 by Tobias Zimmergren

So, after a few weeks of conferences around the globe (PDC, TechEd) the time has come for the TechEd EMEA 2008 Developer tracks.

I’m leaving for Barcelona in the morning, tomorrow monday, and will arrive during the early noon.

I hope to see some of you guys there, and keep an eye out for updates in my blog!