Archive for January, 2009

Swedish SharePoint Communities – Now we’re talking

January 31st, 2009 by Tobias Zimmergren

This is just going to be a short announcement on what’s going on over here in Sweden, on our side of the globe. So – if you’re not interested about what’s going on over here, stop reading right about now.

Sweden SharePoint Community

As some of you might have noticed, there’s a new community rising in the roots of Sweden – Sweden SharePoint Community.

If you’re not already a member – why not have a go at it and become one today. (It’s in Swedish, so that’s pretty much a required knowledge) :-)

Sweden SharePoint User Group

Sweden SharePoint User Group’s next event is approaching fast and the next meeting will be held in Stockholm the 9th of February. (Read more here)

There will be a meeting in March in Malmö, which will be announced shortly.

TechDays – approaching

TechDays will be held in Västerås the 17-18th of March 2009. Read more

You might have heard it before, a tool called SPDisposeCheck was to be released – a tool which will help you (though, not make it perfect..) on your way with finding memoryleaks in certain API objects (e.g. SPWeb, SPSite..)

MSDN Code now have officially published this tool, and it can be read about and downloaded here

I’m not going to re-author a long post about this tool, so I’m simply hooking up some previous posts about the tool. Have fun with it!

Links

Download & information from MSDN code:
http://code.msdn.microsoft.com/SPDisposeCheck

[2008] Announcements from Microsoft Team Blog
http://blogs.msdn.com/sharepoint/archive/2008/11/12/announcing-spdisposecheck-tool-for-sharepoint-developers.aspx

Starting a SharePoint workflow from code (Event Receiver)

January 25th, 2009 by Tobias Zimmergren

Author: Tobias Zimmergren
URL: http://www.zimmergren.net

In one of my current projects I was facing the issue of triggering a workflow – but didn’t want the entire workflow to kick off unless absolutely necessary.

Instead of the traditional approach where you hook up your workflow to trigger on new items or items being changed, I want to make a check to see if anything really had changed and then check a few other variables before even starting the workflow at all.

This resulted in me creating an Event Receiver which then could take care of the logic to see if the workflow should start or not. (Note that you’ll have to assess if this approach is doable in your situation, as it might not be applicable in all scenarios)

With this post I presume that you’ve got basic knowledge in creating a workflow and event receivers and will simply jump to the place in the code where my receiver takes care of the validation stuff and then (if validation == okay) starts the workflow.

Start a SharePoint workflow programatically

In the Workflow project

First of all, in your workflow project (In my case it’s a SharePoint Sequential Workflow) – look for the following line of code as shown below (usually in the AssemblyInfo.cs file) and remember and/or note this GUID. This is the GUID we need to know in order to identify our workflow from the Event Receiver

Locate and note the GUID of your WF (AssemblyInfo.cs)
image

Note; In my Workflow project, I choose not to hook the workflow up with “Start at item change” since I don’t want the WF to start (at all) unless I have validated a few variables first (done in the Event Receiver)

In the Event Receiver project

Complete codeblock for the Event Receiver
My code looks like this but the custom logic for validating weather to start the WF or not, has been removed 
image

The important part we need to focus on is the wfManager.StartWorkflow() method, which is the code that actually starts the workflow if certain criteria’s are met as per the checks above.

Summary

I wrote this post as a reminder to myself when I need to kick-start a workflow somehow, but I do hope it can help someone else out there as well.

Have a great weekend!

SharePoint development environment now running Windows 7

January 17th, 2009 by Tobias Zimmergren

I thought I’d share my new personal SharePoint Development Environment with you, since it’s probably the best setup I’ve ever used!

Specifications

HP Elitebook 8530w

CPU: 2.53 GHz
Intel Core 2 Duo T9400 6 MB cache

RAM: 6 GB
DDR II SDRAM – 800 MHz – PC2-6400

Disk: 250 GB
S-ATA 7200rpm

Graphics: 512 MB
NVIDIA Quadro FX770M

OS: Windows 7 beta build 7000
Bloody well awesome!

Those are some of the main specs of this machine, for more details check out this link

Virtual PC – oldie but goodie

As you may know VPC is rather dead today and will most likely not be developed much further, and the thing to focus on is either Hyper-V or VMWare if you want 64-bit guest OS’s running virtually.

However, running 64-bit guest OS isn’t a requirement for me at the moment, so running Windows 7 + Virtual PC 2007 SP1 is an awesome setup. Say what you want about Virtual Machines and SharePoint Development – but this is probably the fastest, most efficient way I’ve ever developed on any platform. Heck, the Guest OS (Server 2003) in my VPC runs faster than my Vista laptop at home.

Summary

If you’re a SharePoint developer, you’ve got a laptop to spare (or want to wipe the existing one), want more efficiency and power while developing – GO GET WINDOWS 7

<End of Windows 7 promo :-) />

Author: Tobias Zimmergren
URL: http://www.zimmergren.net

SharePoint Online, Standard – How do we develop and customize?

Today Microsoft released the whitepaper called “SharePoint Online Standard Developer Guide Dec 2008” which is a document that will walk you through how you can get started with customizations and development on the SharePoint Online platform. (aka. the cloud)

TOC Overview

The main sections described in this document are as follows;

  • Getting Started
  • Creating SharePoint Online Sites
  • Customizing SharePoint Online Applications
  • Using a Data Form Web Part in SharePoint Online Applications
  • Using SharePoint online Web Services

Download whitepaper

You can download the whitepaper from here: http://www.microsoft.com/downloads/details.aspx?familyid=d007f35e-375c-4b11-bc40-bc9082bb224a&displaylang=en&tm

Cheers, and enjoy!

[Tiny post]

As many of you might have experienced when you create your own custom list definition, you can also create your custom forms (DispForm.aspx for example).

In my case, I want the DispForm.aspx to use another master page than it originally does, and so I thought I’d just change the following line of my DispForm.aspx:

From:

<%@ Page language="C#" MasterPageFile="~masterurl/default.master" …%>

To:

<%@ Page language="C#" MasterPageFile="~/_layouts/zTest/test.master" …%>

Problem

Doing this will most likely cause you to receive the following known error message:

An error occurred during the processing of . The referenced file ‘/_layouts/zTest/test.master’ is not allowed on this page.

Solution/Workaround

Instead of changing the MasterPageFile attribute of the Page directive, inject some server-side script in the DispForm.aspx in order to change the MasterPageFile property though code.

In your DispForm.aspx, do the following:

  • Keep the MasterPageFile=”~masterurl/default.master” attribute
  • Insert the following server-side script directly undet the <%@ Page … %> directive:

<script runat="server">
    protected void Page_PreInit(object sender, EventArgs e)
    {
        this.MasterPageFile = "~/_layouts/zTest/test.master";
    }
</script>

  • Watch your DispForm.aspx use a new Master Page without getting the error message.

Thanks to

I’d like to shout out to MVP Eric Schupps for giving me this smart tip.
I just might buy you a beer, Eric.