Archive for April, 2009

WSS and MOSS: Service Pack 2 Released Today!

April 28th, 2009 by Tobias Zimmergren

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

Introduction

Previous major updates for SharePoint related technologies has been:

Today – as promised – Microsoft released the next set of updates called Service Pack 2.

For an overview of major updates and rollups/cumulative updates post SP1, check out my mate Spence’s awesome blog here: http://www.harbar.net/articles/postsp1.aspx

The new WSS 3.0 SP2 brings this to the table:

Quoted from the Microsoft sites in the links section below!

Some big areas of the improvements that the Windows SharePoint Services team wanted to highlight:

  • Faster, more reliable content migration and data backup and restore
  • Reduced memory consumption
  • Smoother upgrade experience
  • Significant database performance adjustments
  • Updated integration for forms authentication
  • Advanced permission management
  • Helpful administrative tools
  • Expanded browser compatibility

The new MOSS 2007 SP2 brings this to the table:

Quoted from the Microsoft sites in the links section below!

Microsoft Enterprise Content Management (ECM)

  • Improves the performance and stability of the content deployment feature and of the Variations feature.
  • Adds a new command to the Stsadm.exe tool. This tool provides the following functionality:
    • Lets a SharePoint administrator use the Variations feature to scan a site for errors, report the errors, and fix certain problems.
    • Finds and repairs missing peer relationships and corrupted entries in the internal variations relationships list.
    • Handles the propagation of large volumes of variations content in a more manageable way.

Microsoft Office Excel and Microsoft Office Access services

  • Fixes Open Snapshot so that snapshots open more reliably, even if there is no SharePoint root site.
  • Fixes display issues that cause calculations to appear incorrect in some cases.
  • Improves connections to cubes by using .odc files in non-English cases.
  • Improves the performance of programmatic scenarios.
  • Fixes conditional formatting in Mozilla Firefox browsers.
  • Improves support for generating Excel Web Access Web parts on new sites.

Microsoft Office Groove Server (64-bit version only)

  • Office Groove Server 2007 Data Bridge now limits the number of file-sharing workspaces to 64 to make sure that all workspaces can be synchronized. This limit applies only to newly added file-sharing workspaces. If you already have more than 64 file-sharing workspaces, you can continue to use them.
  • Improves synchronization reliability.
  • Groove Server 2007 Manager can be installed and run with SQL Server 2008.
  • Improves the Groove Lightweight Directory Access Protocol (LDAP) connectivity and auto-activation functionality.
  • Improves error reporting in the Groove Relay Server.
  • Improves the robustness of Groove Relay Server.

Microsoft Office Forms Server

  • Improves performance of large browser forms on InfoPath Form Services, both for memory usage and for page load time.
  • Improves reliability of Forms Server and of Microsoft Office SharePoint Server by addressing the previous behavior in which an upgrade of an administrator-approved form template triggers an IIS reset.
  • Improves the Digital Signature functionality for InfoPath Forms Services.

Microsoft Office Project Server

  • Modifies the queue service to prevent it from using large volumes of memory over long periods.
  • Improves the performance of certain database table indexes.
  • Improves cost resource functionality. For example, the server now correctly handles tasks that have material or work resources assigned to the same task.
  • Improves certain areas such as resource plans, build team, and the server scheduling engine.

Microsoft Office Search Server

  • Improves the reliability and stability of WSS crawl, of SharePoint crawl, of crawling through a very large corpus, and of backup restore.
  • Introduces a new command to the Stsadm.exe tool that lets a SharePoint administrator tune the Query processor multiplier parameter. For example, the Query processor multiplier can be used to tune the query performance for SSP indexing content sources that have highly restrictive permissions and many duplicates.
  • Improves the accuracy of searches that involve numbers. For example, there is additional support for large numbers in which a comma is used to separate every three digits (for example, 1,000,000), for numbers that are between 9 and 40 characters, and for numbers that are separated by spaces.

Platform support

  • Provides full support for Windows Internet Explorer 8.
  • Provides level 2 browser support for Mozilla Firefox (versions 2 and 3).
  • Provides support for Windows Server 2008

Summary, Links & Downloads

MOSS 2007
Download: MOSS 2007 SP2 Download
KB: MOSS 2007 SP2 Knowledge Base Article

WSS 3.0
Download: WSS 3.0 SP2 Download
KB: WSS 3.0 SP2 Knowledge Base Article

Recommended articles related to SharePoint

April 23rd, 2009 by Tobias Zimmergren

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

Introduction

I use FeedReader to manage all my RSS feeds, and sometimes I tag some of the articles as "favorite" or "starred" articles – so I easily can find them when needed.

With that said, here’s some of the articles I’ve been tagging as recommended reading during the last couple of weeks/month.

Note: There’s plenty of more fish in the sea, these are just some of the tagged posts I’ve been looking at and I recommend reading.

Recommended reading, in no particular order

SharePoint Governance and Get Your Project Started Right Decks
MVP Robert L. Bouge

My Sites – Market Yourself!!
MVP Liam Cleary

SharePoint Work Acceleration Toolkit 2007 aka (SWAT)
MVP Pierre Erol GIRAUDY

Favorite CodePlex SharePoint Projects
MVP Bil Simser

Customizing master-detail lists with SharePoint Designer
Searching your SharePoint sites with Internet Explorer 8
MVP Agnes Molnar

How to Implement Governance and Taxonomy™ Planning in SharePoint
Quick and Simple Method to Establish Your Policy Governance Team
Mark Schneider

HOW TO- Enhance SharePoint User Profiles With The Business Data Catalog
MVP Todd Baginski

http://www.21apps.com/category/agile/testing/ (All posts tagged with testing is worth a look!)
MVP Andrew Woody

JQuery – A Fresh Look at What YOU Can Do On SharePoint Without Server Code
Joel Oleson aka. SharePointJoel

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

Introduction

A lot of people have been asking me what my current development platform looks like in terms of virtual machines, what OS I’m developing on, what tools I use etc.

With this post I will try to summarize what my current virtual development environment looks like!

Note: For different enterprise-projects, this will look a lot different of course. This post only covers my main on-a-daily-basis machines that I use to develop and customize SharePoint, and not the complete harem of my setup! :-)

A few different environments

I’ve got a couple of different environments running for my SharePoint playground.

  • Main development environment
    • VPC: MOSS+SQL, 3700 MB RAM
    • VPC: DC, 1024 MB RAM
  • Main testing/deploy environment
    • VPC: MOSS+SQL, 2048 MB RAM
    • VPC: DC, 1024 MB RAM
  • Legacy development environment
    • VPC: MOSS+SQL, 3700 MB RAM
    • VPC: DC, 1024 MB RAM
  • Legacy testing/deploy environment
    • VPC: MOSS+SQL, 2048 MB RAM
    • VPC: DC, 1024 MB RAM

I’ve got a couple machines running in Hyper-V as well, but they’re out of the scope for my "daily-basis" rigs. I may cover them in another post.

Main Development Environment

In my main development environment I am currently running the following setup:

  • Microsoft Windows Server 2008
  • Microsoft SQL Server 2008
  • Microsoft Office SharePoint Server 2007 SP1 + rollups
  • Microsoft Visual Studio 2008 SP1
  • Microsoft Office Ultimate 2007
  • Microsoft SharePoint Designer (this product is now FREE by the way)
  • WSS SDK
  • MOSS SDK
  • Visual Studio extensions for Windows SharePoint Services 3.0

That is the baseline for my setup, and on top of that I am running a bunch of third-party tools to make the life of a developer and administrator a heck more efficient:

  • WSPBuilder, awesome dev-tool by Carsten Keutmann
  • WarmUpScript, I still use this from time to time!
  • Application Pool Manager, great tool by Spence Harbar
  • SharePoint Manager 2007, another awesome tool by Carsten Keutmann
  • CAML Query Builder, the foremost important tool next to the WSPBuilder in my rig!
  • BDC MetaMan, great BDC Definition Editor by LightningTools
  • .NET Reflector

The tools mentioned above are the tools I ALWAYS have installed on ALL my dev machines, then of course on a case-to-case scenario there’s a bunch of other tools I may need to install.

Scroll down to the end of this article to see links to other great tools, of which some I am using myself!

Legacy development environment

The tools I use are the same, but the main setup looks like this:

  • Microsoft Windows Server 2003
  • Microsoft SQL Server 2005
  • Microsoft Office SharePoint Server 2007 SP1 + rollups
  • Microsoft Visual Studio 2005 (+VS 2008 if needed)
  • Microsoft Office Ultimate 2007
  • Microsoft SharePoint Designer
  • WSS SDK
  • MOSS SDK
  • Visual Studio extensions for Windows SharePoint Services 3.0

Legacy testing/deploy environments

When I need to test my products, solutions and fancy-pancy code – I usually switch over to an independent  machine which is installed from scratch in order to make sure that all the solutions works without any underlying or unknown dependencies.

This environment is basically a replica of the development rig.

No development tools installed here!

Other tools for the toolbox

Bil Simser has written up a good list of "Favorite CodePlex Projects" which I find very interesting.

Vincent Rothwell aka. The Kid as an awesome summary of his dev toolbox that might be worth checking out

There’s a bunch of great tools on CodePlex, so if you havn’t checked it out already – DO SO NOW

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

Introduction

This is yet another very simple example of a question I’ve been getting over and over the past couple of months through comments and emails – instead of answering it each time in the mail, I’m simply shooting it out here.

Deleting a Field from a View programmatically

Alright, here’s a good starting point for you to check out if you simply want to remove a field from the view. Simple as that.

SPList list = SPContext.Current.Web.Lists["MyAwesomeList"];
SPView view = list.Views["MyView"]; 

if(view.ViewFields.Exists("MyField"))
{
    bool allowUnsafe = SPContext.Current.Web.AllowUnsafeUpdates; 

    SPContext.Current.Web.AllowUnsafeUpdates = true;
    view.ViewFields.Delete("MyField");
    view.Update(); 

    SPContext.Current.Web.AllowUnsafeUpdates = allowUnsafe;
}

Summary

The aforementioned code is all there’s to it in order for you to get started.
Simple, quick, effective!

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

Introduction

I’ve been getting a couple of requests to provide details on how you can upload a file or document using the SharePoint Object Model, instead of using the UI.

With this simple article, I’m walking you through the process of uploading any file to your Document Library.

Note; Since this is done through the local API, you need to have this code running on the server. That means that it’s ideal to use in for example a FeatureReceiver or EventReceiver. You cannot run this code on the client in e.g. a Windows Form, then you’ll need to utilize the SharePoint WebServices instead.

Code to upload a file/document to a SharePoint Document Library

Use the following code to get you started in uploading a file using the object model. It really isn’t that hard :-)

// Getting a reference to the document library
var sp = new SPSite("http://localhost");
var site = sp.OpenWeb();
var folder = site.GetFolder("Documents");
var files = folder.Files;

// Opening a filestream
var fStream = File.OpenRead("C:MyDocument.docx");
var contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();

// Adding any metadata needed
var documentMetadata = new Hashtable {{"Comments", "Hello World"}};

// Adding the file to the SPFileCollection
var currentFile =
    files.Add("Documents/MyDocument.docx", contents, documentMetadata, true);

site.Dispose();
sp.Dispose();

As you can see in the image below, the metadata "Comments" has been filled in as per the metadata I specified in the code above.

File uploaded using the Object Model

Simple as that. Over and out!

TechDays 2009 Sweden – Summary of the event

April 18th, 2009 by Tobias Zimmergren

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

Introduction

I know, it’s a tad late – but better late than never, right?

TechDays 2009 is done for this time around. It was the first TechDays to take off in Sweden, but I surely do hope to see more of those events going on!

"A success for a fully booked TechDays: 2 days, 100 sessions, 100 speakers and 1300 people attending the sessions. Microsoft’s first – and largest – Swedish event for IT Pro’s, developers and IT-managers has come to an end. A lot of appreciated sessions, lots of social networking and evening mingle."

- Microsoft

Tibi TechDays 2009 Västerås TechDays 2009 Västerås 

Sweden SharePoint User Group / Sweden SharePoint Community

As a representative for the Sweden SharePoint User Group and Sweden SharePoint Community (link), I met a bunch of cool people – as well as signing up a bunch of new members.
I even handed out FREE T-Shirts with the tagline "Sweden SharePoint User Group" written on the back, which was sponsored by BambooSolutions – thanks Bamboo!

We’re constantly growing, and it seems to be a huge interest for the User Group meetings we are providing. It wouldn’t be possible without you – the SharePoint users, editors, designers, administrators, developers, haters and lovers! Thanks.

Community and UG status: 200+ members on the page, and another 600 people on the UG event mailing list who have signed up for www.sharepointforum.com

SharePoint rules, and don’t you dare say anything different! ;-)

It’s not all work and business

During the evenings, we all shared a few pints and drinks of golden love (beer/whisky).
I met one of the most interesting and cool guys I’ve ever met, in the first picture below. Then it’s me and Göran Husman sharing a pint, and then during break at the event.

MVP Tobias Zimmergren and.. Einstein? MVP Göran Husman, MVP Tobias Zimmergren MVP Göran Husman

Summary

I did enjoy the TechDays 2009 in Västerås, and I will most definitely be around next time as well!
I do hope to see as many of you Swedish guys and gals as possible there!

Thank you Microsoft for organizing this awesome event. Kudos.

WSPBuilder supports Windows Server 2008

April 18th, 2009 by Tobias Zimmergren

My pal Carsten Keutmann has done some updates with his marvelous tool WSPBuilder to make it support Windows Server 2008 as well.

All my development-machines are running Server 2008 along with Visual Studio 2008 and of course – the latest release of WSPBuilder.

You can download the latest release of WSPBuilder from here

WSPBuilder

For introduction and thorough coverage of the tool and it’s capabilities, check out my previous post on the subject here: "WSPBuilder – Walkthrough of the Visual Studio Add-in".

Have a great weekend, and don’t code too much SharePoint now in this awesome weather!

WSPBuilder – Walkthrough of the Visual Studio Add-in

April 8th, 2009 by Tobias Zimmergren

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

Introduction

Alright. People have approached me lately and asked me if I could give them a brief introduction to the WSPBuilder extensions available for Visual Studio. Instead of taking all those discussions on one by one, I’ve decided to document some of the main features here. If I’m missing out on something, please let me know and I’ll fill it up.

Bil Simser did a survey with the SharePoint MVP’s and summarized the foremost favorite CodePlex projects in this article. 

In this article I will cover one of my favorite tools – WSPBuilder.

WSPBuilder background

A SharePoint Solution Package (WSP) creation tool for WSS 3.0 & MOSS 2007
No more manually creating the manifest.xml file
No more manually specifying the DDF file
No more using the makecab.exe application

Carsten Keutmann, an MVP and friend in Copenhagen is the brilliant mind behind this awesome application.

The idea behind the WSPBuilder add-in for Visual Studio is that it’s based on any normal "Class library" template – which means that you can easily copy your entire WSPBuilder project to a machine that doesn’t have WSPBuilder and still be able to open the project. – This is something you can’t do with a lot of other extension tools (say, the VSeWSS for example)

WSPBuilder Installation

Just download the latest release of the "WSPBuilder Extensions – Visual Studio Addin" and let the installation guide take you through the most simple process ever – clickety click.

Creating a WSPBuilder project

When you have installed the add-in to Visual Studio, you should now be able to create a new project based on the "WSPBuilder" template.

To kick this off, let’s create our WSPBuilder project:
image

Note: You don’t have to create a WSPBuilder template, you can create a normal Class Library as well. The only thing about a WSPBuilder template is that it will automatically create the "12" folder along with a temporary strong-key so you don’t have to do that right now.

When you’ve created the project, you’ll see a structure like this one in your solution explorer:
 image

The WSPBuilder will create the 12-folder, since it’s good practice to start your projects from the 12-root. It will also add the file "solutionid.txt" which contains a GUID to be used on the .wsp package, for easy reference. You will also get a strong-key generated for you so you don’t have to worry about signing your project right now.

Alright, now that we’re up and running with a blank WSPBuilder project – we should start by adding something to the solution.

WSPBuilder Templates – Overview

In an ordinary fashion, right click on the project and choose Add – New item.
image

Choose the "WSPBuilder" node and you will see an overview over the available templates like this:
image

Let’s walk through each and every one of them! The joy! :-)

Blank Feature Template Overview

A blank feature does exactly what the name implies, it creates a blank feature for you!

I’m creating a blank feature, and naming it to "BlankFeature1" so we easily can distinguish it from the other folders created later on.

With WSPBuilder, when you create a new item based on a template, you’ll get a dialog asking you for some variables – and since this is a feature, it’s going to need a Title, Description and of course a Scope:
image

Your solution tree will be populated with a few new things, in this case the BlankFeature1 that we chose to create:
image

As you will see, you get not only the perfectly correct 12-hive structure – you will also get the feature.xml and elements.xml files created for you, and the feature.xml file can look like this:

<?xml version="1.0" encoding="utf-8"?>
<Feature  Id="8e039720-d7df-460a-8d65-c52e47417fdf"
          Title="BlankFeature1"
          Description="Awesome description for BlankFeature1"
          Version="12.0.0.0"
          Hidden="FALSE"
          Scope="Web"
          DefaultResourceFile="core"
          xmlns="http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>   
  </ElementManifests>
</Feature>

Event Handler Template Overview

With the Event Handler item template, you will not only get the correct 12-structure in your solution – you will also get the reference to "Microsoft.SharePoint.dll" added automatically, since an event handler requires some talking to the SharePoint Object Model.

We will get our feature.xml and elements.xml as normal – but this time the elements.xml is pre-populated with some tags to hook up our event handler:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="100">
    <Receiver>
      <Name>AddingEventHandler</Name>
      <Type>ItemAdding</Type>
      <SequenceNumber>10000</SequenceNumber>
      <Assembly>Zimmergren.SharePoint.Demo.WSPBuilder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b7201b5590fd1fc0</Assembly>
      <Class>Zimmergren.SharePoint.Demo.WSPBuilder.EventHandler1</Class>
      <Data></Data>
      <Filter></Filter>
    </Receiver>
  </Receivers>
</Elements>

As you can see, the elements.xml file is referring to the assembly called Zimmergren.SharePoint.Demo.WSPBuilder and a class called EventHandler1.

With the magic of WSPBuilder, this class has of course also been created for us and will look something similar to this:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace Zimmergren.SharePoint.Demo.WSPBuilder
{
    class EventHandler1 : SPItemEventReceiver
    {
        public override void ItemAdded(SPItemEventProperties properties)
        {
            base.ItemAdded(properties);
        } 

        public override void ItemAdding(SPItemEventProperties properties)
        {
            base.ItemAdding(properties);
        } 

        public override void ItemUpdated(SPItemEventProperties properties)
        {
            base.ItemUpdated(properties);
        } 

        public override void ItemUpdating(SPItemEventProperties properties)
        {
            base.ItemUpdating(properties);
        } 
    }
}

Solution Installer Configuration

If you’ve ever used the SharePoint Installer from CodePlex, you know that when you want to use it with your own .wsp file you need to do some adjustments to the configuration xml.

With the Solution Installer Configuration template you will get this configuration automatically created and hooked up with your project. The Setup.exe.config file might look like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="BannerImage" value="Default"/>
    <add key="LogoImage" value="None"/>
    <add key="EULA" value="EULA.rtf"/>
    <add key="SolutionId" value="6e23b11d-8460-49a0-b2f1-b8aa78d7c58d"/>
    <add key="FarmFeatureId" value="bb1586eb-3427-483b-baa5-ae5498c47d69"/>
    <add key="SolutionFile" value="Zimmergren.SharePoint.Demo.WSPBuilder.wsp"/>
    <add key="SolutionTitle" value="Zimmergren.SharePoint.Demo.WSPBuilder"/>
    <add key="SolutionVersion" value="1.0.0.0"/>
    <add key="UpgradeDescription" value="Upgrades {SolutionTitle} on all frontend web servers in the SharePoint farm."/>
    <add key="RequireDeploymentToCentralAdminWebApplication" value="true"/>
    <add key="RequireDeploymentToAllContentWebApplications" value="false"/>   
  </appSettings>
</configuration>

Web Part Feature

This is by far one of the most popular templates, as it crates a generic template for your web part and also creates the feature for provisioning the Web Part to the Web Part Gallery.

You will get the elements.xml file configured something like this:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="WebPartPopulation" Url="_catalogs/wp" RootWebOnly="TRUE">
    <File Url="WebPartFeature1.webpart" Type="GhostableInLibrary">
      <Property Name="Group" Value="MyGroup"></Property>
      <Property Name="QuickAddGroups" Value="MyGroup" />
    </File>
  </Module>
</Elements>

and you’ll get the required .webpart file configured something like this:

<?xml version="1.0" encoding="utf-8" ?>
<webParts>
  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
    <metaData>
      <type
        name="Zimmergren.SharePoint.Demo.WSPBuilder.WebPartFeature1,
        Zimmergren.SharePoint.Demo.WSPBuilder,
        Version=1.0.0.0,
        Culture=neutral,
        PublicKeyToken=b7201b5590fd1fc0" />
      <importErrorMessage>
            Cannot import WebPartFeature1 Web Part.
      </importErrorMessage>
    </metaData>
    <data>
      <properties>
        <property name="Title" type="string">WebPartFeature1</property>
        <property name="Description" type="string">
            Description for WebPartFeature1
        </property>
      </properties>
    </data>
  </webPart>
</webParts>

and you will get the WebPartFeature1.cs file created automatically (or whatever you choose to name it) and it usually look like this:

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace Zimmergren.SharePoint.Demo.WSPBuilder
{
    [Guid("a043d73d-7418-4918-baed-828a2bc77019")]
    public class WebPartFeature1 : Microsoft.SharePoint.WebPartPages.WebPart
    {
        private bool _error = false;
        private string _myProperty = null; 

        [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        [System.ComponentModel.Category("My Property Group")]
        [WebDisplayName("MyProperty")]
        [WebDescription("Meaningless Property")]
        public string MyProperty
        {
            get
            {
                if (_myProperty == null)
                {
                    _myProperty = "Hello SharePoint";
                }
                return _myProperty;
            }
            set { _myProperty = value; }
        } 

        public WebPartFeature1()
        {
            this.ExportMode = WebPartExportMode.All;
        } 

        /// <summary>
        /// Create all your controls here for rendering.
        /// Try to avoid using the RenderWebPart() method.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                { 

                    base.CreateChildControls(); 

                    // Your code here…
                    this.Controls.Add(new LiteralControl(this.MyProperty));
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        } 

        /// <summary>
        /// Ensures that the CreateChildControls() is called before events.
        /// Use CreateChildControls() to create your controls.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnLoad(EventArgs e)
        {
            if (!_error)
            {
                try
                {
                    base.OnLoad(e);
                    this.EnsureChildControls(); 

                    // Your code here…
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        } 

        /// <summary>
        /// Clear all child controls and add an error message for display.
        /// </summary>
        /// <param name="ex"></param>
        private void HandleException(Exception ex)
        {
            this._error = true;
            this.Controls.Clear();
            this.Controls.Add(new LiteralControl(ex.Message));
        }
    }
}

Web Service Template

The following files will be automatically created for you:

  • 12LAYOUTSWebService1.asmx
  • WebServiceCodeWebService1.cs

WebService1.asmx may look like this:

<%@ WebService Language="C#"
Class="Zimmergren.SharePoint.Demo.WSPBuilder.WebService1,
Zimmergren.SharePoint.Demo.WSPBuilder,
Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=b7201b5590fd1fc0"  %>

WebService1.cs may look like this:

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace Zimmergren.SharePoint.Demo.WSPBuilder
{
    [WebService(Namespace = "http://schemas.microsoft.com/sharepoint/">
  <ElementManifests>
    <ElementManifest Location="elements.xml"/>
  </ElementManifests>
</Feature>

FeatureWithReceiver1.cs might look like this:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

namespace Zimmergren.SharePoint.Demo.WSPBuilder
{
    class FeatureWithReceiver1 : SPFeatureReceiver
    {
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            throw new Exception("The method or operation is not implemented.");
        } 

        public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            throw new Exception("The method or operation is not implemented.");
        } 

        public override void FeatureInstalled(SPFeatureReceiverProperties properties)
        {
            throw new Exception("The method or operation is not implemented.");
        } 

        public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
        {
            throw new Exception("The method or operation is not implemented.");
        }
    }
}

Sequential Workflow Feature and State Machine Workflow Feature Templates

Creates the necessary files to get started with your Sequential Workflow code.

  • 12TEMPLATESequentialWorkflowFeature1elements.xml
  • 12TEMPLATESequentialWorkflowFeature1feature.xml
  • WorkflowCodeSequentialWorkflowFeature1.cs
  • WorkflowCodeSequentialWorkflowFeature1.designer.cs

The same routine applies to the State Machine Workflow Feature template.

 

Web Part Without Feature

Finally, you can create a Web Part without the feature – basically just creating the .webpart file and the .cs file.

  • 80wpcatalogWebPart1.webpart
  • WebPartCodeWebPart1.cs

Solution tree overview

Since I’ve been bashing all kinds of templates in here, you’ll see that there’s a huge tree of files – all automatically created in less than 1 minute.

image

Template Overview Summary

Alright, the templates I’ve been mentioning before are great to get rolling with a new SharePoint project. But what about deployment of this solution? How do we create our .wsp file, and how do we choose where the files should land (Global Assembly Cache – GAC – or the /bin folder?)

That’s what the next section is all about – bringing some clarification to how the WSPBuilder creates your packages.

WSP Creation and Deployment with WSPBuilder

So, when we’re satisfied with our awesome project and want to build a .wsp package from it – we can simply choose to right click the project -> WSPBuilder -> Build WSP and it will automatically create the .wsp for us:
image

This will create a .wsp file in your project folder like so:
image

Now, if you want to check the contents of the .wsp package, you simply rename the .wsp file to .cab and open it, like so:
image

Manifest.xml

In the cabinet (.wsp package) you will find the file called Manifest.xml - this is the file that tells SharePoint where to actually deploy the solution – GAC or BIN.

If you don’t do any changes at all, this file will look something like this:
image

As you can see, the DeploymentTarget is set to "GlobalAssemblyCache"  and your dll will go into the GAC.

Now, in this particular case we can not deploy to the /bin folder anyway – as we have types in our assembly that MUST go into the GAC (Workflows and EventReceivers are two of those types).

But if we were to have a Web Part project or what not – and we want to deploy it only to the /bin folder, follow along with the next few steps.

Scoping the assembly for BIN instead of GAC (including Code Access Security generation)

Okay. So you don’t want it in the GAC, but in your BIN folder instead. That’s okay, just follow along with these few simple steps:

  • Remove your /bin/debug folder entirely from your solution (make sure the .dll gets wiped)
  • If the 80-folder in your project root isn’t created – create it
    • Create a folder called "bin" folder in the 80 folder
    • Your solution tree should look something similar to this:
      image
    • Right click your project and choose "Properties"
    • Choose the "Build" tab
    • Change the Output path from "binDebug" to "80bin":
      image

When you build your project now, your .dll should pop into the "80bin" folder in your solution tree like this:
image

Ready to Rock – Scoping the assembly for the /bin folder

If we go about building our .WSP package again (right click project – WSPBuilder – Build WSP) and rename the .wsp to .cab and check the manifest.xml file – we should see two things done different:

  • DeploymentTarget is set to WebApplication (any chosen WebApp, e.g. /bin)
    image
  • Some general CAS (Code Access Security) permissions has been automatically added to make your assembly run:
    image

Deployment with WSPBuilder

Okay. So we’ve created our project, scoped it either for GAC (do nothing) or for /bin (make the changes in the previous section) – and we want to deploy it. What do we do?

  • Right Click the Project -> WSPBuilder -> Deploy
    Your output window will show something like this:
    image

Check your Solution Management in Central Administration under the tab "Operations" and make sure it’s successfully deployed:
image

Conclusion and Summary

This post simply walks through some of the more popular features of the WSPBuilder created by my pal Carsten Keutmann in Copenhagen.

If there’s any questions or comments – please add them in the comments section below.

Thanks

Microsoft SharePoint Designer 2007 is now officially FREE

April 2nd, 2009 by Tobias Zimmergren

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

Download SharePoint Designer for Free!

For a few weeks there has been a numerous people spreading the rumor that SharePoint Designer is going to be a free download.

Today Microsoft made it official, and we can gladly share the word: Microsoft SharePoint Designer 2007 is now a FREE download for anyone.

If you register the product, you’ll even get free customized support!

More details on the product here:
http://office.microsoft.com/en-us/sharepointdesigner/FX100487631033.aspx?ofcresset=1

Link to download section here:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42

Quote from the Microsoft Download site

SHAREPOINT DESIGNER 2007 IS NOW FREE! Be sure to watch the video in the "Related Sections" below to learn more about details and future direction. Office SharePoint Designer 2007 provides the powerful tools you need to deliver compelling and attractive SharePoint sites and quickly build workflow-enabled applications and reporting tools on the SharePoint platform, all in an IT-managed environment.