SharePoint Sharpener

Obsessively Sharpening SharePoint

Archive for May 2009

How To Always Link to the Right Application Pages

with one comment

As a SharePoint developer you’ve probably run into this problem several times: How to make sure that links to application pages stay valid irrespective of where within a site collection your web part is placed.

If you hand-code links you’re likely to get the path relative to the root site wrong. Even worse, if the the filename of an application page is changed, e.g. from DispForm.aspx to DispFormNew.aspx, your links will surely break.


The application pages

Generally, a SharePoint list contains the following application pages:

  • AllItems.aspx
    Shows all items in the list
  • DispForm.aspx
    Displays a read-only version of a list item
  • NewForm.aspx
    Form for creating a new list item
  • EditForm.aspx
    Form for editing an existing list item

More applications pages exist but these are the ones most commonly used.


Ensuring unbroken links programmatically

The PAGETYPE Enumeration gives you access to the application pages and enables you to build links that always work.

Assuming you have already created your SPList and SPListItem objects the below snippet builds a link to the correct DispForm:


Of course, the same applies to NewForm and EditForm.


Linking to the default view of a list

Below a list of elements you may wish to link to the underlying list’s default view. In many cases this will be the AllItems.aspx page but what happens if a user changes the default view in the settings of the list? If you’ve hardcoded a link to AllItems.aspx you may be lucky that the link still works but if AllItems.aspx has been renamed or removed, you’re out of luck.

Instead of hardcoding the link you should use PAGE_DEFAULTVIEW, like this:


Simple, isn’t it?


Written by Thomas Sondergaard

May 16, 2009 at 3:01 pm

Groove is now SharePoint Workspace 2010

leave a comment »

According to the Groove dev team’s blog, Microsoft Groove is to be integrated more tightly with SharePoint and in the process be given a new name.

SharePoint Workspace 2010 is the new official name for Groove.

I wonder how many more products Microsoft will collect under the SharePoint umbrella before the next release? It seems like Microsoft are aiming to capitalise on the SharePoint name and rebrand some of their lesser known products and even roll them into SharePoint.

Written by Thomas Sondergaard

May 15, 2009 at 9:11 pm

Posted in News

Tagged with ,