Jaap Vossers’ SharePoint Blog

February 4, 2010

Released: SharePoint WebPartSlices

Filed under: CodePlex, Development, SharePoint, Tools — Jaap Vossers @ 12:06 pm

I have recently released my sixth CodePlex project (list of all my CodePlex projects), titled SharePoint WebPartSlices.

To all the jQuery fans - Sorry, no jQuery this time! SharePoint WebPartSlices is a server-side solution that allows users to transform all Web Parts on a page into IE8 Web Slices simply by adding the webslices=1 querystring parameter to the url of the page containing the web parts to be transformed, basically allowing you to add web parts to your IE8 Favorites Bar.

webpartslices1

Voilà - No need to navigate to the original page to see the updated Web Part.

webpartslices2

Installation consists of a WSP deployment + Feature activation only.

SharePoint WebPartSlices on CodePlex

December 27, 2009

Per-Location View Settings in SharePoint 2010 (Views per Content Type)

Filed under: SharePoint 2010 — Jaap Vossers @ 10:13 pm

What’s that supposed to mean? That’s what went through my head when I saw a new link which had appeared on the List Settings page (listedit.aspx) in SharePoint 2010.

perlocview1

When I clicked the link, I was directed to a page where I could manage the available views per “location”.

perlocview2

The word “location” can have many different meanings. My initial thought was that it was referring to folders inside the list and that this page is used to configure which views are available per folder.

This turned out to be correct. I added a folder to the list and was able to make my custom view appear on there, whilst hiding it from the root of the list.

Is that all? Why call it locations when you mean folders? Well, because it does not only apply to folders!

You can configure available views for ANY NODE in the “Metadata navigation”. As a result, In addition to views per folder - depending on how you set up your Metadata navigation for your list - you can:

  • Define views that are available only on items of a particular Content Type (my favourite, demonstrated below)
  • Define views that are available only on items that have a particular value for a field of type single-value choice.
  • Define views that are available only on items that have a particular term applied to it on a field of type Managed metadata.

Let me demonstrate how to make our “Books Grouped by Author” view available only to our Book content type in our Products list, whilst hiding it for all other type of products in the list.

Below is a summary of all the steps. I will only discuss the last two steps where we configure Metadata navigation and the Per-location view settings, as this what this article is all about.

  1. Create custom list Products
  2. Create content types:
    1. Book (Title, Price, Author)
    2. Movie (Title, Price)
    3. Music Album (Title, Price, Artist)
  3. Configure list to allow management of Content Types
  4. Associate Book, Movie and Music Album with list and delete Item Content Type
  5. Populate list with items for each Content Type
  6. Create view Books Grouped by Author
  7. Configure Metadata navigation
  8. Configure Per-location view settings

Once we have successfully performed steps 1 to 6, we need to bring up the Metadata navigation settings screen for our list. The link to this page can be found on the List Settings page. In the Configure Metadata Hierarchies section, we need to select the “Content Type” item from the list on the left and move it to the right and press OK

perlocview3

As a result, we should now get a hierarchical navigation control on the left of our list.

perlocview4

Once that’s done, we need to bring up our Configure per-location view settings page. The link to this page can also be found on the List Settings page. On the left, there is a hierarchical control labelled “Location to Configure”. We need to use this to select the node (or Location if you like) to which we will be applying the configuration defined on the right. We start with the root node, which is selected by default. We don’t want our grouped view to be available at the root, so we select it in the “Views available at this location” list and move it to the “Views hidden from this location” list and press Apply. Next, we need to expand the “Content Type” node in the tree on the left and select Book. By default it is configured to inherit its settings from its parent, which it not what we want. Set this to No, and move the grouped view to the “Views available at this location” list. While we are at it, let’s move the All Items view to the “Views hidden from this location” list, so that our grouped view becomes the default view for the Book Content Type, and press OK.

perlocview5

Navigate to the list. When selecting Book in the Metadata Navigation on the left, the grouped view should now show instead of the All Items view. Note that  the Book Content Type node in the metadata navigation, is also the ONLY location where our grouped view is available.

perlocview6

On a final note, I noticed that the Per-location view settings link does not appear on the List Settings page when the list is contained in a Blank Site. I performed the actions above on a Team Site. Presumably certain Features needs to be activated to enable this functionality, however I currently don’t know which one. Also, I am not sure how much of this functionality depends on SharePoint Server 2010 and whether it will work on a SharePoint Foundation installation.

December 16, 2009

jQuery Developer Frameworks for SharePoint

Filed under: CodePlex, SharePoint, Web Services, jQuery — Jaap Vossers @ 12:06 pm

If you are into developing SharePoint solutions using jQuery, you should really have a look at the following GREAT CodePlex projects. Both projects have been developed by real experts in the SharePoint & jQuery field :)

jPoint - Developed by a team lead by Will Lawrence (@willhlaw)

jPoint is an open source javascript API and script deployment framework for Sharepoint. It leverages the speed and agility of jQuery to manipulate Sharepoint forms and pages, communicate to Sharepoint webservices, and to build jPart plugins.

jQuery Library for SharePoint Web Services - Developed by Marc D Anderson (@sympmarc)

This is a jQuery library which abstracts SharePoint’s Web Services and makes them easier to use. It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities. It works entirely client side and requires no server install.

December 13, 2009

Released: SharePoint 2010 Developer Dashboard Visualizer

Filed under: CodePlex, Development, SharePoint 2010, Tools, jQuery — Jaap Vossers @ 10:12 pm

As announced before, I have been working an open source project that visualizes the data in the Developer Dashboard in SharePoint 2010.

The good news is that SharePoint Developer Dashboard Visualizer is now up on CodePlex.

SharePoint 2010 Developer Dashboard Visualizer is a jQuery-based solution that extends the Developer Dashboard by plotting an interactive diagram with data from the Developer Dashboard, giving you an **instant** insight into where the bottlenecks are in your code.

Developer Dashboard Visualizer

(yes, well spotted… I was stupid enough not to rename my machine before installing SharePoint 2010)

The installer is just a WSP so it’s a quick and easy install!

Finally, a big thank you goes out to Bil Simser for being the first person to post a review for SharePoint Developer Dashboard Visualizer online.

Context in SharePoint 2010 Business Connectivity Services (or the lack of it)

Filed under: Development, SharePoint 2010 — Jaap Vossers @ 1:10 pm

The problem I see with Business Connectivity Services is the lack of context available when writing your custom code to retrieve and update data. As a result, custom BCS implementations are not very reusable because the lack of configuration options per External List.

Let’s look at an example.

ACME Ltd, an ISV focusing on selling SharePoint products, wants to develop and sell a BCS solution that allows customers to create External Lists based on data that resides in ANOTHER SharePoint site collection. In a nutshell, the External List will contain a “virtual” list item for each site in the target site collection. Now how does the BCS code know where this target site collection is? You could hardcode the url, or you could store the url in the appSettings in the web.config for your web app. These are both solutions that will give you headaches when you need more than one instance of this External List, each using the same BCS code, but retrieving data from different target site collections.

When I created a new Business Data Connectivity Model in Visual Studio 2010 for the first time and I looked at the code that was initially generated (Entity1Service.cs), I was surprised that there seemed to be no way to derive any of the following in code:

  • SPWeb instance or url of the site that contains the External List we are trying to load data for.
  • Name (or ID) of the External List we are trying to load data for. This, together with an SPWeb, would allow you to read per-list configuration data from SPList.RootFolder.Properties
  • Some string containing configuration data that applies to our BCS Entity to External List association. Something similar exists for EventReceivers and Workflow, so why does it not exist for BCS?

I would be very interested to hear people’s thoughts on this subject.

November 27, 2009

How to interpret the information in the Developer Dashboard in SharePoint 2010

Filed under: CodePlex, Development, SharePoint 2010, Tools, jQuery — Jaap Vossers @ 4:44 pm

When I first had a look at the Developer Dashboard in SharePoint 2010 I was a bit confused. The numbers shown in the nested unordered list on the left, representing load times in milliseconds, didn’t seem to actually cover 100% of the the request that was being handled. Basically it turns out that there are “gaps” that are not monitored, which is exactly why the sum of execution times for a certain set of child nodes in the list often don’t match the execution time of the parent. This is due to the SPMonitoredScope model.

Each node in the list represents a SPMonitoredScope that was created, either in SharePoint OOTB code or in code that you wrote yourself. When a second SPMonitoredScope is created before the first one is disposed, the second one will be treated as a child scope of the first one. In the context of a web request, the top level scope is instantiated in the SPRequestModule. Scopes that you instantiate yourself will most likely become child scopes of this “Request scope”.

Lets look at an example for a custom Visual WebPart that creates it’s own scopes.

   1:  protected void VisualWebPart1_Load(object sender, EventArgs e)
   2:  {
   3:      using (SPMonitoredScope mainScope = new SPMonitoredScope("VisualWebPart1_Load mainScope"))
   4:      {
   5:          Thread.Sleep(5000); // some processing that is not inside a subscope
   6:   
   7:          using (SPMonitoredScope subScope1 = new SPMonitoredScope("VisualWebPart1_Load subScope1"))
   8:          {
   9:              Thread.Sleep(1000);
  10:          }
  11:   
  12:          using (SPMonitoredScope subScope2 = new SPMonitoredScope("VisualWebPart1_Load subScope2"))
  13:          {
  14:              Thread.Sleep(1000);
  15:          }
  16:   
  17:          using (SPMonitoredScope subScope3 = new SPMonitoredScope("VisualWebPart1_Load subScope3"))
  18:          {
  19:              Thread.Sleep(1000);
  20:          }
  21:      }
  22:  }

Now let’s look at the resulting Developer Dashboard output.

scopes

Do you see what I mean?

Now on  a similar note, I have been working on a project that visualizes the data rendered by the Developer Dashboard. It’s just not easy enough to spot “peaks” without it. 

As you might have guessed, it’s a jQuery based solution. I am hoping to put it on CodePlex soon. Here is a sneak peek (click to enlarge):

devdashvis1

November 3, 2009

Released: SharePoint LiveListData

Filed under: CodePlex, Development, SharePoint, Tools, Web Services, jQuery — Jaap Vossers @ 11:40 pm

Last week I published my fourth CodePlex project, called SharePoint LiveListData. It is an “assembly-free”  solution which means that it contains no server side code. It is implemented as a jQuery plugin.

So what does it do? It uses AJAX to automatically reload any list-based Web Parts as soon as a change in the underlying list data is detected. You can also have your custom web parts refreshed, as long as they have a web part property that contains the ID of the list they depend on!

I have put online a screencast that demonstrates the the user experience.

Want to know how it works? Allow me to describe using some pseudo code..

  • OnDocumentLoaded
    • Make a single call to WebParts.asmx web service using AJAX to return an xml document with all web parts on the current page
    • Parse returned xml and find all web part nodes that contain a ListID element (which holds the value for the ListID web part property)
    • Create and populate a javascript object that contains a list of all ListIDs that we found in the returned xml, plus a list of all WebPartIDs per ListID, also retrieved from the xml (more or less creating a hashtable with the key being the ListID and the value being an array or WebPartIDs).
    • LOOP with interval = $configured_interval
      • Make a single call to Lists.asmx web service using AJAX to retrieve “LastDeleted” and “Modified” properties for each ListID in the hashtable that was created earlier.
      • For each ListID in hashtable
        • compare values for LastDeleted and Modified with those values retrieved as part of the previous loop iteration for this ListID (unless it’s the first iteration).
        • If a change in one of the two property values has been detected (indicating that someone inserted, updated or deleted an item) mark this ListID as “UpdatePending”, storing it on our javascript object that holds our ListIDs and WebPartIDs.
      • If any of the ListIDs are marked as UpdatePending
        • Make an AJAX request to page that is currently loaded in the browser (allowing us to get a fresh copy of the current page containing the new list data)
        • For each ListID marked as UpdatePending
          • For each WebPartID associated with ListID in our javascript hashtable object thingy
            • Replace div with matching WebPartID attribute in current document with “same” div in AJAX response (which contains the new list data).

This is basically how it works in a nutshell.

For examples on usage, check out the downloads tab on the SharePoint LiveListData CodePlex site, where you can also download the script!

October 30, 2009

A developer’s thoughts on the Microsoft SharePoint Conference 2009 in Las Vegas

Filed under: Development, SharePoint, SharePoint 2010 — Jaap Vossers @ 1:09 pm

After having attended the Microsoft SharePoint Conference in Las Vegas last week, I decided to write a blog post in which I will summarise my thoughts on SPC09 and SharePoint 2010 from a Developer point of view.

The majority of the sessions I attended were developer-oriented sessions.  There are so many new promising features that will greatly increase developer productivity.  I seriously can’t wait to start my first SharePoint 2010 project!

Let’s just walk through some of the new features that I think are most promising.

Client Object Model

The Client Object Model is a richer alternative to the already existing SharePoint web services. Before SharePoint 2010, anyone writing code that would run somewhere else then on the actual SharePoint server could not use the Server Object model but instead had to rely on using the SharePoint web services.  If you knew how to use the Server Object model, that didn’t necessarily mean you knew how to deal with the web services, since they are so different!

SharePoint 2010 Introduces the Client Object Model which comes in three flavours: Javascript, .NET CLR and Silverlight. It basically means that your code can call into the Client Object Model, which exposes a programming interface that is very similar to the Server Object model programming interface. The idea is that you can apply your knowledge of the Server Object Model to the Client Object Model.

I am particularly looking forward to using the Javascript Client Object Model, combined with jQuery. Any half-decent developer will now be able to build rich, AJAX-enabled UI’s in SharePoint 2010 without too much effort.

REST API

The REST API is another feature that will simplify the process of consuming data from client applications by exposing a very simple HTTP based interface. It basically allows you to fetch or update/insert/delete data in SharePoint. You can specify what data you want to work with by constructing a url that SharePoint understands. The url will include parameters for the web, the list and possibly a filter that SharePoint will use to scope the operation to. If you are simply performing a fetch of the data, the server will return XML or JSON (depending on what you asked for by adding the right HTTP header to your request) for you to consume in your client application.

Again something that will be very useful in a javascript client, with or without jQuery, as you can perform AJAX requests in the background to fetch or modify data. Fetched data returned as JSON can easily be converted into javascript objects for further consumption in your javascript code.

For .NET clients there is a thing called ADO.NET Data Services which allows you to create DataSources that point to a REST url, which can then be used as the DataSource for databound controls. One of the sessions at SPC09 demonstrated how easy it is to set up a grid with insert/update/delete support, simply by binding it to such a datasource. Amazing!

SPMetal + LINQ

Cool! Now you won’t have to write those pesky CAML queries anymore AND you won’t have to access SPListItem field values through an indexer that returns an object that isn’t strongly typed - which in turn means that you don’t have to perform any casting anymore. Querying is now done via LINQ, which I am sure you have heard of before. You can actually perform inner joins in LINQ allowing you to use only one query to return all Employee items where Employee.Company.CompanyName == “Microsoft”. In SharePoint 2007 you need to perform two separate queries to achieve this. I am curious how this works under the hood. My understanding is that your LINQ query is translated to a CAML query which is then executed. If that’s true then presumably they have extended the CAML query schema to support JOINs. Does anyone have an answer to this?

SPMetal is the commandline tool that generates the classes to support LINQ Querying and strongly typed access to properties of an SPListItem.

Business Connectivity Services

This is the replacement for Business Data Catalog. It allows you to write data access code which can be used to connect alternative data source to SharePoint lists. SharePoint users won’t even notice that the “list data” they are working with is in fact stored somewhere else.

I really hope my code can access this external data as if it was contained in a standard SharePoint list, for example by using the SPList and SPListItem classes or performing LINQ queries. Does anyone have an answer to this?

Developer Dashboard

The developer dashboard helps developers with identifying poorly performing code by having diagnostic information related to your current request printed on the page. It is similar to the ASP.NET trace information, but more SharePoint-specific. It prints processing time for Web Parts (allowing you to instantly spot which one is causing the page to be so slow) and even processing time for the underlying Stored Procedures that are executed by SharePoint!

PowerShell

PowerShell is the new STSADM for SharePoint. Microsoft has invested heavily in PowerShell support for SharePoint by providing hundreds new SharePoint-specific Cmdlets! Looks very promising. I have this PowerShell book somewhere - I think I will pick it up again soon!

Visual Studio integration

Visual Studio 2010 integration for SharePoint 2010 development has strongly improved. I must say that for some reason I had assumed Microsoft would provide this level of integration when MOSS 2007 came out a few years ago (wishful thinking), but unfortunately we’ve had to depend on third party tools like WSPBuilder to produce our deployment artifacts. I guess it was necessary for us to go through this pain in order for us to be able to appreciate what’s coming our way now!

Custom Service Applications

There is no such thing as an SSP in SharePoint 2010. Instead there is a collection of Services Applications, to which you can add your own custom Service Application. The main focus lies on scalability - it supports load balancing and you can decide which servers in the farm will run your custom Service Application.

It is very important to plan properly and decide whether a custom Service Application is the right solution to your problem. Developing custom Service Applications might well be the most complex subject within SharePoint Development.

September 22, 2009

Increasing the size of your VM disk using VMWare and GParted

Filed under: Virtualisation — Jaap Vossers @ 1:24 pm

UPDATE: Although the instructions below still work, it appears that this method is a bit outdated since there is a much easier method out there!  VMWare ConverterCredits to Peter vd Berg, thanks!

Disclaimer: playing with partitions is always a risky thing and can mess up your machine. I cannot be held responsible for any harm done to your machine as a result of following the instructions below. The instructions happened to work for me, but I cannot guarantee that they will work for you!

Let’s say you have a VM that has a C: drive that reports low disk space on daily basis, and you spend every day cleaning up log files, hoping to free up at least 100 mb of disk space in your VM so you can continue your development stuff for another day…

This situation is actually quite common I think, but it seems that still a lot of people don’t seem to know how to properly deal with it. I think the problem lies with the fact that a lot of people seem to think that increasing the size of disk also automatically increases the size of the partition on it - which is not true.

After having read a few articles on the web and some experimenting I have written down a summarised set of steps in my own words which will help you increase the size of your disk and your partition inside a VM, without having to buy any commercial partitioning tools like Partition Magic.

  1. Backup all vm files
  2. Run vmware-vdiskmanager.exe to increase the disk size (this does NOT increase the partition the drive).
    “C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe” -x 30Gb “D:\MY_VM.vmdk”
    Replace the value of –x parameter with the new size of the disk. vmware-vdiskmanager.exe comes with VMWare workstation, which unfortunately it’s not free - but you should be able to download a trial version from the VMWare site.
  3. Open the .vmx file with notepad and add the following line to make it easy to get into the bios:
    bios.bootDelay = “5000″
  4. Download the GParted live cd ISO image (open source alternative to partition magic) and mount it to the virtual machine using VMWare.
    http://sourceforge.net/project/showfiles.php?group_id=115843&package_id=271779
  5. Start up the VM and use F2 to go to the bios. Change the boot order to have the cd drive on top and reboot.
  6. Run GParted to increase the size of the c: partition.
  7. Change back boot order, remove bootdelay and unmount cd.

DONE

September 20, 2009

New version of SharePoint InlineSiteSettings released (javascript only)

Filed under: CodePlex, SharePoint, Tools, jQuery — Jaap Vossers @ 8:42 pm

SharePoint InlineSiteSettings is a tool which I originally released several months ago. It provides a quick way to access your Site Settings in SharePoint; it allows you to pop up the Site Settings of the current site - triggered by a keyboard shortcut - without navigating away from the current page. InlineSiteSettings uses jQuery to power its AJAX functionality.

After I was hinted by Jeroen Ritmeijer from Muhimbi that a javascript only version of SharePoint InlineSiteSettings (the previous version was implemented as a serverside WebControl spitting out javascript) would work very well with their free SharePoint Infuser product, I started my investigation and ended up implementing a new version of SharePoint InlineSiteSettings! I am quite pleased that it is now a very compact solution compared to it’s previous release.

You COULD use the new version SharePoint InlineSiteSettings without Muhimbi Infuser by pasting the script into a Content Editor Web Part on each page where you want to enable the SharePoint InlineSiteSettings functionality, BUT to be honest, this doesn’t really make sense and it would be very time consuming. What we really want is a solution that allows us to inject the script on every page and configure it only once. This is where SharePoint Infuser comes into play.

Please try it out and let me know your thoughts!

Download SharePoint InlineSiteSettings 1.2 from CodePlex

June 6, 2009

Using Google Ajax Libraries API to load jQuery

Filed under: jQuery — Jaap Vossers @ 7:16 pm

Google provides a client side API (Google AJAX Libraries API) for developers to load the jQuery library on their web pages without the need to host the jQuery library on your own site. This is particularly interesting for jQuery based scripts that can be hosted in a Content Editor Web Part in SharePoint, since you can more or less “embed” the jQuery library in your script, thereby simplifying its distribution and installation processes. The CEWP version of SharePoint InstantListFilter implements this concept.

There are several other reasons why it may be a good idea to use Google’s API to load jQuery. Have a look at 3 reasons why you should let Google host jQuery for you.

Now, one thing you need to be aware of, is that your browser may start bugging you with warnings if your site runs on https. This is because it does not like having both secure (https) and non-secure (http) items on a single page.

mixedcontent

In that case, all you need to do is to load Google’s API over https as well, which should remove the non-secure item from the page.

So in your script replace this:

<script src=”http://www.google.com/jsapi”></script>

With this:

<script src=”https://www.google.com/jsapi”></script>

April 19, 2009

Reusable Content & HTML Snippets

Filed under: Content Management, Publishing, SharePoint — Jaap Vossers @ 11:10 pm

So your client wants to be able to insert more than just formatted text and images in his Publishing HTML field control? So he wants to insert those fancy looking boxes that your graphics designer made? Ah, but they are variable height and require several background images so we are talking about inserting a bit of “complex” html. How can we provide a user friendly interface with as little customisation as possible? I personally like the out-of-the-box Reusable Content functionality provided by MOSS 2007. I will demonstrate how it can be used to solve our problem.

Let’s take the following box for example:

rc-start

Because of the vertical scaling requirements, the box needs to be split into three logical sections: header, content, footer. The html for the box shown is as follows:

<div class="box">
    <div class="box-header">This is the header</div>
    <div class="box-content">Lorem ipsum ...</div>
    <div class="box-footer">&nbsp;</div>
</div>

The styling of the box, including the background images is done via CSS. The header and footer are fixed height, whereas the content area is variable height and has a background image that repeats in the vertical direction.

Back to SharePoint - when you create a site collection using the Publishing Site Site Definition, you should have a list called Reusable Content in your root web. You can navigate to it using Site Content and Structure. We will create an item in this list that will be a “template” for our box.

Insert a new item into the Reusable Content list. Ensure you have Automatic Update turned OFF. Use the Edit HTML Source on the html editor to paste in the following html:

<div class="box">
    <div class="box-header">[HEADER] </div>
    <div class="box-content">[CONTENT]<div>
    <div class="box-footer">&nbsp;</div>
</div>

The rest of the fields are for you to fill in. Save the item and then approve it (the Reusable Content list has content approval turned on by default).

Now that we have our box html template in place, let’s go to our page that needs to have an instance of the box appear on it. Go to edit mode and locate your Publishing Html Field Control. Click the toolbar button Open a new window to Insert Reusable Content.

rc-insertfromeditor

Select the item that we created earlier and press OK. If everything went well, an instance of the box with text placeholders has been inserted into your Publishing HTML Field control.

rc-inserted1

All there is left to do is to place the cursor in the text placeholders and replace it with the actual content.

rc-inserted2

On a final note, be aware of the risk involved when content editors play around with div elements. I have seen situations where content editors got “creative” and partially deleted boxes, leaving orphaned div opening tags and turning the layout of your page into scrambled eggs.

April 10, 2009

TunnelPoint review

Filed under: Services, SharePoint, Web Services — Jaap Vossers @ 7:51 pm

Last Wednesday during the UK SharePint event in London, Daniel McPherson from Zevenseas mentioned their new TunnelPoint service (Beta). I was kind of curious what the fuss was all about so I decided to spend a little time playing with it. I am quite excited and I must say that I love the concept. Let me try and explain how it works.

TunnelPoint is a hosted service provided by Zevenseas. It connects external services (for example SOAP web services) to SharePoint List data in your SharePoint Site. TunnelPoint uses the built-in SharePoint SOAP web services exposed by your SharePoint environment to read and write list data. Really, all you need to do is log in to TunnelPoint using your TunnelPoint account and use the web interface provided to configure which external services should map to which lists in your SharePoint site. Once you have completed your configuration, TunnelPoint will periodically consume the service and update field values in your list. The whole idea being that you do not touch your server and you do not write a single line of code.

tunnelpoint_overview

Currently, TunnelPoint offers several services to connect with, one of which is a Currency Conversion service. I decided I would try that one out. My goal was to have a list of currency conversions in my hosted WSS site, and have TunnelPoint periodically perform the conversion for me based on the latest exchange rates.

I performed the following steps to achieve my goal:

  1. Registered with TunnelPoint.com to get a Beta user account
  2. Setup a SharePoint site within my hosted WSS environment.
  3. Created a user and added it to the owners group of my newly created site
  4. Logged in TunnelPoint.com and registered my SharePoint site by supplying its url and account credentials to be used by TunnelPoint to access the web services of my SharePoint site.
  5. Using the TunnelPoint web interface, I added the Currency Conversion service and configured it to point to the site I registered earlier and configured it to create the list for me.
  6. Manually added list items to the newly created list in my SharePoint site. These list items can be seen as tasks to be processed by TunnelPoint.
  7. Wait for TunnelPoint to operate on my list

This is what my list looked like before TunnelPoint started doing its work:

tunnelpoint_list_before

Now, after a few minutes, TunnelPoint started to wake up and decide it should update my To Amount fields by applying the currency conversion (using the external service) for each list item.

After TunnelPoint did its job, my list looked like this:

tunnelpoint_list_after

It all works like a charm and the fact that I got this to work on my hosted WSS environment where I have limited access to (I can’t even deploy a Feature to it) opens so many doors for so many people.

In my example I only connect to the Currency Conversion service, but Zevenseas offers several other services like, SMS, stock quote, short url and web site preview + more services to be added later.

On a final note, to make TunnelPoint even more powerful I would like to suggest to Zevenseas to provide a generic service, where you can configure a SOAP web service url and define mappings between list fields and web service parameters. That way the pool of services to connect to instantly grows from several, to… a lot more!

Thumbs up Zevenseas!

Twitter meets Jaap

Filed under: Twitter — Jaap Vossers @ 11:43 am

I did try out Twitter some time ago but I did not catch the Twitter bug. I suppose it’s not really motivating to tweet anything if you only have one follower (quicker to just give him a ring instead).

I have decided to give it another go, so please don’t hesitate to follow me on Twitter.

April 4, 2009

Live demo online for SharePoint InstantListFilter

Filed under: CodePlex, SharePoint, Tools, jQuery — Jaap Vossers @ 1:40 pm

Not so long ago I posted something on my blog about a tool I released on CodePlex, called SharePoint InstantListFilter.

I have just put a live demo online so you can try it out before installing it.

Go check it out!

April 2, 2009

cmd.exe Command History with F7

Filed under: Administration, SharePoint — Jaap Vossers @ 2:06 pm

Go and open a cmd.exe window, run a few commands and press F7…

Wow! Nice surprise, I never realised that existed. Very useful when you need to re-run some (stsadm) commands. Apparently it works in PowerShell as well.

cmd

Thank you Dan Lewis.

March 30, 2009

Released: SharePoint InstantListFilter

Filed under: CodePlex, SharePoint, Tools, jQuery — Jaap Vossers @ 8:40 pm

The latest addition to my CodePlex portfolio is called SharePoint InstantListFilter.

It is an assembly free solution and you can even “install” it by editing the contents of a Content Editor Web Part! So what is it really? It is a javascript based solution that adds filter textboxes to every column of a SharePoint list view (SPGridView) with filter-as-you-type functionality. It uses jQuery to add the textboxes and perform the filtering.

Update: Live demo online

One cool freebie is that you can use it to filter on field types that normally aren’t filterable, like calculated fields and note (multiple lines of text) fields.

instantlistfilter_cropped

Instructions on how to install can be found on the CodePlex site.

Download SharePoint InstantListFilter @ CodePlex

March 29, 2009

Released: SharePoint QuickLaunchExtender

Filed under: CodePlex, SharePoint, Tools, jQuery — Jaap Vossers @ 11:47 pm

Most of the out of the box SharePoint sites use the QuickLaunch menu. The size of this menu gradually grows as the number of sub sites and lists grow. I have heard many people complain about how they cannot easily find a particular navigation item when it is so crowded.

I published a free solution on Codeplex called SharePoint QuickLaunchExtender. It enriches the QuickLaunch menu. It comes with a custom configuration page that allows you to specify the behaviour of the QuikcLaunch menu. It works on both WSS 3.0 and MOSS 2007. SharePoint QuickLaunchExtender comes with a Solution Package (WSP), so there are no manual installation steps to take.

This is the description of SharePoint QuickLaunchExtender on codeplex:

“Extends the SP QuickLaunch control to provide a richer experience. Configure it to transform the QuickLaunch into an Accordion, a set of collapsible/expandable panels (Adds scrollbar per panel if height limit is specified and exceeded), or a real-time filterable list. Uses jQuery”

Basically, in addition to the default behaviour of the QuickLaunch menu, there are three modes that SharePoint QuickLaunchExtender introduces.

  • Expand/collapse (optionally with configurable panel height limit)
  • Accordion
  • Filter

Expand/collapse mode allows you to click one of the headings - just right next the heading link) to toggle the expand/collapse state of the panel that contains its related child links. You can configure whether all panels should be expanded or collapse on page load. Also, you can specify a limit in pixels for the panel height. If the limit for any of the panels is exceeded because of the amount of links on that panel, a vertical scrollbar will automatically be added to that panel to cater for any overflow.

Accordion mode also allows you to click one of the headings, however, only one panel will be in expanded state at all times. You can configure the panel height in pixels.

Filter mode is a mode that has been added after the first release. It is now my personal favourite now! It adds a textbox to the top of the QuickLaunch menu and allows you to filter the links in the QuickLaunch menu in a filter-as-you-type manner. This is really useful when your QuickLaunch menu tends to get very big.

Demo screencast:

I apologise for the poor readibility in the video above. In the video I demonstrate the different modes of SharePoint QuickLaunchextender as I configure it using the custom configuration page

Download SharePoint QuickLaunchExtender @ CodePlex

March 26, 2009

The WSP Boat

Filed under: Deployment, SharePoint — Jaap Vossers @ 2:28 am

At work I develop many Features and often wrap them in Solution Packages (WSP) so I can just throw it all over the fence of the company that is responsible for managing the servers and running code deployments. However, these guys did not actually understand what they were doing. They were blindly following the installation guide that describes the calls to stsadm for solution deployment. Sure, they managed to do what I wanted them to do, but I would prefer if they would understand what they were doing so they could do some troubleshooting if a Feature would fail to install for example. So I sat down with them and came up with an analogy of having soldiers (Features) that need to be deployed to battle fields (Web Applications) on a remote island (Farm). The soldiers need to be put inside a vehicle (WSP) that transports them to the barracks (Solution store) of the island. From there the soldiers can be deployed to the battle fields.

Obviously a WSP can contain more than just Features, but for the sake of simplicity I have not included deployment of 12 hive files, DLL’s, and CAS policies in the drawing.

I call it: The WSP Boat

wspboat

March 25, 2009

ASPX Workflow Task Edit Forms - The Easy Way

Filed under: SharePoint, Workflow — Jaap Vossers @ 1:49 am

When developing custom Visual Studio workflows for SharePoint you have the choice to use InfoPath form templates or ASPX forms for your task edit forms. Many people go down the InfoPath route because implementing ASPX forms is not as simple as you would hope. Doing it the ASPX way involves creating a dedicated Content Type for each type of task that your Workflow creates. You could actually end up managing dozens of Task Content Types, which is no good.

So why does the InfoPath approach not require all these additional Content Types? When using InfoPath forms, in your Feature that deployed the Workflow Template, you associated every single InfoPath form template (.xsn) with an integer value - the Task Type. In your workflow code, upon creation of a workflow task using the CreateTask activity, you can specify which InfoPath template should be used as the task edit form for this particular task. You do this by setting the integer property TaskType on the TaskProperties property on the CreateTask activity. This value should correspond with the value that you used to map to your desired InfoPath form template in your Feature.

Under the hood, this integer value will be used to set the value for the Task Type field (which is defined on the hidden Content Type “Workflow Task”) on the List Item representing the task.

If you are doing it the InfoPath way, your InfoPath Form will be dynamically loaded by /_layouts/WrkTaskIP.aspx as you navigate to your task, based on the Task Type field value on the task List Item.

Hold on a second… why not build our own equivalent of WrkTaskIP.aspx that does the same trick, but instead of loading an InfoPath template it will load a custom Control!

I am assuming you know how to create custom application pages that reside in the _layouts folder. Create a page at /_layouts/yourproject/TaskEditor.aspx with your code behind somewhere in one of your assemblies.

We need to update the Workflow Task content type to have its EditFormUrl and DisplayFormUrl properties point to our new page. This needs to be done through code just once, for example with a Console Application or an ASPX page with code behind.

using(SPSite site = new SPSite("http://yoursite"))
{
  using(SPWeb web = site.RootWeb)
  {
    SPContentType ct = web.ContentTypes[new SPContentTypeId("0x010801")];

    ct.EditFormUrl = "_layouts/yourproject/TaskEditor.aspx";
    ct.DisplayFormUrl = "_layouts/yourproject/TaskEditor.aspx";
    ct.Update();
  }
}

Alternatively, if you don’t like changing the out of the box Content Types, you could create one single Content Type that inherits from Workflow Task and set the EditFormUrl and DisplayFormUrl properties on this Content Type.

Right. Now that we have our TaskEditor.aspx page and our Content Type set up we can start implementing TaskEditor.aspx and its code-behind.

Firstly, add an asp:PlaceHolder to the markup of TaskEditor.aspx and add a field member into the code-behind class with a name equal to the ID so we can reference it from our code.

We then need to override the CreateChildControls method of our page. We will dynamically instantiate our control (we don’t know what to load yet, but we will soon find out!) in here and add it to the asp:PlaceHolder’s Controls collection.

Let’s read the value of the Task Type field on the task List Item.

int taskType = (int)SPContext.Current.ListItem["Task Type"];

You should create a method that returns an object of type Control and accepts the integer taskType parameter. The implementation of this method is really up to you. I implemented it in such a way that it uses Page.LoadControl() to load an ascx UserControl that is expected to reside at /_controltemplates/myproject/taskeditors/[taskType].ascx

Convention over configuration, I love it.

Next, after calling your method that creates the Control, you need to add it to the asp:PlaceHolder’s controls collection.

We are almost there! All we need to do is create a Button (either on the Page, or in your Control) to attach the “Complete Task” code to, so the Workflow can resume its execution - assuming an OnTaskChanged activity is waiting for the task to be updated.

All that is required for the implementation of the event handler is this:

SPContext.Current.ListItem.Update();

You could choose to set Status to Completed before updating it, or your could do this in your workflow by using a CompleteTask activity.

Obviously you would implement your custom controls based on your requirements, which may include things like validation + friendly validation messages, display of external data, capturing of additional data, and any other business logic. All things that are not too easy to achieve with InfoPath’s limited flexibility. And another cool thing is that the deployment process is so much easier now!

I hope this article was useful to you. I am sorry for not providing ready-to-run code, but it is merely the concept that I am trying to push to the outside world.

Thanks!

March 19, 2009

Released: SharePoint InlineSiteSettings

Filed under: CodePlex, SharePoint, Tools, jQuery — Jaap Vossers @ 12:14 am

As a SharePoint developer, I have to navigate to the Site Settings page literally hundreds of times a day. I was getting fed up with the amount of steps required and the time involved to get to the Site Settings page.

For a WSS site:

  1. Move mouse to Site Actions menu
  2. Click Site Actions menu
  3. Move mouse to Site Settings menu item
  4. Click Site Settings menu item
  5. WAIT for page to load…

For a MOSS site:

  1. Move mouse to Site Actions menu
  2. Click Site Actions menu
  3. Move mouse to Site Settings menu item
  4. Move mouse to Modify All Site Settings menu item
  5. Click Modify All Site Settings menu item
  6. WAIT for page to load…

What’s that, 5 seconds maybe? Times 100?

If you are a good developer, your brains are likely to be moving faster than your hands. Having the system respond to your input without making you feel that you are being slowed down by it will greatly improve your development experience. To get into - and stay in - “the zone” you should not break that chain of quick commands. Shortcut, tab, tab, type, enter, mouse, click, f5, alt+tab, shortcut, woohaa - ninja mode!

This article is about a free solution that I developed that eliminates a painful sequence of mouse movements and clicks by replacing it with a single keyboard shortcut. Not only that! It will introduce direct navigation paths between pages that were not linked before. Navigate from Site Features to Site Content Types? From Content and Structure to Master Page Gallery? How?

  1. Keyboard shortcut
  2. Click link

SharePoint InlineSiteSettings will allow SharePoint users to press Ctrl+s to instantly access the Site Settings of the site belonging to the page you are currently on. It will actually be displayed inside the page you are currently viewing, at the top.

How does it work? SharePoint InlineSiteSettings performs an AJAX call to settings.aspx and extracts an html fragment from the response. This fragment is the table containing all the links that appear on the Site Settings page. By the time the user triggers the keyboard shortcut, the html fragment has already been loaded into the DOM of the current page, and only needs to be made visible - which is exactly what the javascript event handler for the keyboard shortcut does.

SharePoint InlineSiteSettings uses jQuery to perform the AJAX call, enable keyboard shortcut event handling (using the jQuery HotKeys plugin) and perform DOM manipulations.

SharePoint InlineSiteSettings has been implemented as a WebControl that will render mainly javascript, Certain properties can be set on the WebControl to customize its behavior. To allow deployment via a feature, I originally intended to implement a Feature that would use the AdditionalPageHead delegatecontrol. I soon found out that the BlueBand.master masterpage (which is the default master page for a publishing site) does not contain the AdditionalPageHead delegatecontrol, which meant that it would not work on a OOTB publishing site. For this reason, I came up with the alternative idea of implementing a custom Site Actions Menu Item that would not really render a menu item, but would only drop the javascript in the head of the page.

In terms of deployment, you can choose whether you prefer to add the WebControl to your master page, or activate a Feature that will register a custom Site Actions menu item. In the latter scenario you have the option of specifying if you want preloading turned on or off. This is done by activating one of the two available site collection scoped Features: InlineSiteSettings vs InlineSiteSettingsNoPreload. Make sure you only have one of these Features activated at a time. No preload basically means that the AJAX call to settings.aspx will be performed as you trigger the keyboard shortcut, which means you will save bandwidth at the price of response time.

The assembly that contains the InlineSiteSettings WebControl also contains the jQuery and HotKeys javascript libraries as embedded resources. These will be references automatically by the InlineSiteSettings WebControl, unless you specify that you do not want this to happen. This can be cone by setting the appropriate properties on the InlineSiteSettings WebControl. This is only possible if you add the InlineSiteSettings WebControl to your master page.

SharePoint InlineSiteSettings is published at CodePlex. It comes with a WSP that will deploy the Features and the required DLL. This DLL will be deployed to your bin folder and comes with a custom CAS policy.

Download SharePoint InlineSiteSettings @ CodePlex

March 16, 2009

Another blog has spawned

Filed under: Uncategorized — Jaap Vossers @ 11:39 pm

Welcome to my blog. Please do come back more often if you are interested in posts on SharePoint development, jQuery and general .NET development.

In my first few posts I will walk through the CodePlex projects that I have recently published. All three of them are enhancements to the standard SharePoint UI and are based on jQuery.

Come back soon!

Powered by WordPress