Enabling HTML and/or Images in a SharePoint List using a calculated field

A client asked me to highlight a row based on the value of a status field... If figured easy, just use a dataview wp, but no, they want to be able to maintain it without using SPDesigner. I always like to give clients what they want, and I wasn't about to tell them to start changing the dataview in notepad... The "proper" way to enable HTML would probably be to create a bew custom field type, but since we need a formula this is not a trivial task; there is however a file which controls the way fields are rendered (see previous post).

We need to modify this to stop sharepoint encoding the HTML. This method has zero performance impact and only takes a few minutes.

To do this the first step is to open \Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML\FLDTYPES.XML

There are a couple of ways to change FLDTYPES.XML that will stop it encoding HTML; the one I've chosen is to look for a hidden tag in the value returned by a calculated field.

You can change any field type, but I need to change the calculated field type as I need to use conditional formating based on a formula.

  1. Locate <FieldName="TypeName">Calculated</Field> in FLDTYPES.XML.

  2. Move down to the <RenderPattern Name="DisplayPattern"> node.

  3. Find the <Default> node.

  4. Add your logic between the <Default> and </Default> nodes.

You can use various functions and properties to enable your logic, please see http://msdn2.microsoft.com/en-us/library/ms439798.aspx for a list. In my case I just needed an If Else as I didn't want to impact on existing calculated fields, so I opted for the <IfSubString> function, as follows:

<Else><Column HTMLEncode="TRUE" AutoHyperLink="TRUE" AutoNewLine="TRUE"/></Else>

The above basically means if the data in the column contains <.RP> then just render the contents. Otherwise do the MOSS default.

You could of course complicate the above and use a switch with <GetFileExtension> like:

<Case Value="RP>">
<Column HTMLEncode="TRUE" AutoHyperLink="TRUE" AutoNewLine="TRUE"/>

The above has the benfit of allowing different logic for different scenarios.

The final step is to create a calculated field that returns <.RP>. Any record with this tag will enable the logic, and since <.RP> is an unknown tag browsers won't render it.

Using <GetFileExtension> you need to make sure your <.RP> is at the end.

The calculated field formula will look something like:

=IF([Active],"<.RP><b style='color:0000ff'>","<.RP><b style='color:ff0000'>") & [Title] &" "& [Column1] &" "& [Column2] &"</b>"

Look here for formulas http://msdn2.microsoft.com/en-us/library/bb862071.aspx

Now just create a view with just your calculated field and you have a list highlighting active records (with limited sorting)... but you could always just create a calculated field for each.

OK now you've probably realized your filtering has HTML... the fix for that is to disable filtering if the column has your tag... create a variable (<SetVar Scope="Request">) in your logic and set it, then check if it's been set outside <RenderPattern> set <Field Name="Filterable">FALSE</Field>. I haven't figured out how to render the heading as it displays without using Javascript... I could write this up one days. Notes: CAML is case sensative, and you'll need to restart IIS for any change to FLDTYPES.XML.

Modify FldTypes.xml to add custom field types and/or change display properties


Each front-end Web server in a deployment of Windows SharePoint Services has one FLDTYPES.XML file located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\XML folder that is used during site or list creation to define how field types are rendered in the different modes for viewing list data.

File Format

The following excerpt outlines the format of FLDTYPES.XML:

<Field Name="TypeName">Counter</Field>
<Field Name="TypeDisplayName">$Resources:core,fldtype_counter;</Field>
<Field Name="InternalType">Counter</Field>
<Field Name="SQLType">int</Field>
<Field Name="ParentType"></Field>
<Field Name="UserCreatable">FALSE</Field>
<Field Name="Sortable">TRUE</Field>
<Field Name="Filterable">TRUE</Field>
<RenderPattern Name="HeaderPattern">
<RenderPattern Name="DisplayPattern">
<RenderPattern Name="EditPattern">
<RenderPattern Name="NewPattern" DisplayName="NewPattern">
<RenderPattern Name="PreviewDisplayPattern">
<RenderPattern Name="PreviewEditPattern">
<RenderPattern Name="PreviewNewPattern">

RenderPattern elements define how an item is displayed in each of the possible modes for viewing list data. These modes include the header patterns used at the top of each list in the toolbar, the modes used in forms for displaying, editing, or creating items, and preview rendering patterns used by a Web-editing application that is compatible with Windows SharePoint Services, such as Microsoft Office SharePoint Designer 2007.

To create a custom field that derives from a base field type, you can add a field definition to the Schema.xml file of a custom list definition Feature. For a programming task that shows how to add a field to a custom list definition, see How to: Create a Custom List Definition. For information about creating a custom field type, see Custom Field Types.


Universal Audio Architecture (UAA) High Definition Audio KB888111 for WinXP SP3

I couldn't get audio working on my laptop with SP3 as it's a Realtek HD, which relies on KB888111 and MS forgot to include it in SP3.

Link: KB888111_SP3.zip thanks to redxii

Usage: Win + R > devmgmt.msc > update audio driver and point to the contents on the KB888111_SP3.zip


Creating and deploying a sharepoint solution package without command line tools

OK so you're a SharePoint developer, and you don't like using command line tools... some think you can't create a solution file and deploy it without using at least makecab or stsadm, but this isn't the case.
What you need to create the solution file (wsp) and deploy it:

  1. Cabpack is a GUI cab compression tool using the MS cab engine.
  2. Either stsadmWin this adds a UI and sends the commands to stsadm or sharepoint solution intinstaller

Create your dll, create a manifest.xml cab it up using cabpack and follow the prompts with sharepointinstaller.

I came about this while trying to debug a solution deployment... read my previous post.

Cabpack has been very useful for quickly fixing/editing site templates. And has also help reduce site templates size to 1/3 using LZX compression type.

An error occurred while parsing EntityName

An error occurred while parsing EntityName. Line 11, position 65. RSSRipper.wsp: The Solution installation failed.
I racked my brain over the above error for a couple of hours (OK maybe 30mins) until I realized the elements.xml file in my solution had an unescaped ampersand.

Fix: Change & for &amp;

Get Publik Key

Like most people you probably use reflector to get the public key, but there's an easier way...
  1. In Visual Studio 2005, click Tools -> External Tools...
  2. Click Add and enter the following into the different fields as displayed in the following:
    Title: Get Public Key
    Command: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
    Arguments: -Tp "$(TargetPath)"
    Uncheck all options, except Use Output window\

Idea source: http://msdn2.microsoft.com/en-us/library/bb861799.aspx


Enumerating sharepoint site templates

You can run stsadm -o enumtemplates
If you've added a template to the Sharepoint Portal Server Template Gallery you'll notice that these template are not listed when using stsadm.
Stsadm will not list stp templates or the default templates either so I'll list them here with Title and Name:

Team Site, STS#0
Blank Site, STS#1
Document Workspace, STS#2
Basic Meeting Workspace, MPS#0
Blank Meeting Workspace, MPS#1
Decision Meeting Workspace, MPS#2
Social Meeting Workspace, MPS#3
Multipage Meeting Workspace, MPS#4
Business Activity Services Team Site, BAS#0
SharePoint Portal Server Site, SPS#0
SharePoint Portal Server Personal Space, SPSPERS#0
SharePoint Portal Server My Site, SPSMSITE#0
Contents area Template, SPSTOC#0
Topic area template, SPSTOPIC#0
News area template, SPSNEWS#0
News Home area template, SPSNHOME#0
Site Directory area template, SPSSITES#0
SharePoint Portal Server BucketWeb Template, SPSBWEB#0
Community area template, SPSCOMMU#0


WinXP SP3 DCOM System Error {DCBCA92E-7DBE-4EDA-8B7B-3AAEA4DD412B}

I slipstreamed SP3 on to my custom WinXP image because I found SP3 to perform admirably well.

Performance is subjective, but... my notebook was using 100% of CPU1 when playing ripped 1080p content and some it wouldn't even play at a reasonable frame rate. I tried everything with the player and drivers, but I didn't resolve the problem until installing SP3. After SP3 CPU1 was at 48%... same video drivers, same player... same XP image but with SP3 slipstreamed over SP2.

After installing SP3 I noticed the below error in the event log and tracing it back through the registry lead me to the NAP Service Agent.

Event Type: ErrorEvent Source: DCOMEvent

Category: None

Event ID: 10016

Date: 28/12/2007

Time: 10:44:58 AM


Computer: RY4VM

Description:The application-specific permission settings do not grant Local Launch permission for the COM Server application with CLSID {DCBCA92E-7DBE-4EDA-8B7B-3AAEA4DD412B} to the user NT AUTHORITY\SYSTEM SID (S-1-5-18). This security permission can be modified using the Component Services administrative tool.

NAP is some *1/2 baked MS Security service used in Win2008 and Vi$ta networks (see below). So disable the service and then stop the COM component from running:

  1. Win + R services.msc
  2. Disable NAP service
  3. Win + R C:\WINDOWS\system32\Com\comexp.msc
  4. Expand Component Services > Computers > My Comp > DCOM Config
  5. Right Click NAP Agent Service
  6. Select Properties > Location
  7. Uncheck "Run application on this computer"

Network Access Protection. Network Access Protection (NAP) is a new client health policy creation, enforcement, and remediation technology that is included in the Windows Vista Business, Windows Vista Enterprise, and Windows Vista Ultimate operating systems, and in the Windows Server 2008 operating system. With NAP, administrators can establish and automatically enforce health policies which can include software requirements, security update requirements, required computer configurations, and other settings. See below for more information about NAP.

Exposure of client devices to malicious software, such as viruses and worms, continues to increase. These programs can gain entry to an unprotected or incorrectly configured host system, and then use this system as a staging point to propagate to other devices on the corporate network. Network administrators have a new platform to mitigate this threat with Network Access Protection (NAP) from Microsoft, a new set of operating system components included with Windows Server 2008 and Windows Vista that provides a platform to help ensure that client computers on a private network meet administrator-defined requirements for system health.

NAP enforces health requirements by monitoring and assessing the health of client computers when they attempt to connect or communicate on a network. Client computers that are not in compliance with the health policy can be provided with restricted network access until their configuration is updated and brought into compliance with policy. Depending on how NAP is deployed, noncompliant clients can be quarantined or automatically updated so that users can quickly regain full network access without manually updating or reconfiguring their computers.

With NAP, administrators can do the following:

  • Help ensure the ongoing health of desktop computers on the LAN that are configured for DHCP or that connect through 802.1X authenticating devices, or that have NAP IPsec policies applied to their communications.

  • Enforce health requirements for roaming laptops when they reconnect to the company network.

  • Verify the health and policy compliance of unmanaged home computers that connect to the company network through a VPN server running Routing and Remote Access (RRAS) service.

  • Determine the health and restrict access of visiting laptops brought to an organization by partners and other guests.

Designed for flexibility, NAP can interoperate with any vendor’s software that provides a System Health Agent (SHA) and System Health Validators (SHVs). NAP also includes an API set for developers and vendors to build their own components for network policy validation, ongoing compliance, and network isolation. Examples of third-party solutions that work with Network Access Protection would be antivirus, patch management, VPN, and networking equipment.

Debugging SharePoint GAC dll's

Debugging sharepoint dll's is pretty straight forward and just like any other dll.

What you need:

  1. The program database file (pdb)

  2. The source files

  3. A compatible debugger (VS 2005)

  4. Access to the dll registered directory (global assembly cache/ webapp bin)

For this example we're gona debug a GAC dll, so the only task post dll registration is to copy the pdb to the GAC directory.

Note: Copying the pdb may NOT be required with VS 2008 as it will look in the project debug directory for the pdb.

To copy the pdb, if required, to the gac you have various options some are listed below by my order of preference.

  1. Use the subst command to map a drive to the GAC

    • Type: Win + R > cmd > Enter

    • subst X: %windir%\assembly\gac_msil

    You should now have an X: drive pointing to your intermediate language assembly cache. Locate your dll directory and copy the pdb file.

  2. Use the copy command to copy your pdb file

    • Type: Win + R > cmd > Enter

    • copy <your_pdb_location> c:\windows\assembly\gac_msil\<your_dll>\<version>__<public_key>

    I create a post build event to accomplish this.

  3. Edit or rename the Desktop.ini file in c:\windows\assembly\

    • Type: Win + R > cmd > Enter

    • attrib c:\windows\assembly\desktop.ini -h -r -s

      rename c:\windows\assembly\desktop.ini desktop.dir

    You should now be able to browse the GAC directory.

  4. Disable cache viewer in the registry

    • Type: Win + R > regedit > Enter

    • create a new dword key under HKLM\Software\Microsoft\Fusion\ with the nane DisableCacheViewer and set it’s [DWORD] value to 1.

      Or you could also just change HKEY_CLASSES_ROOT\CLSID\{1D2680C9-0E2A-469d-B787-065558BC7D43}\Server\ default to xShfusion.dll or delete the value.

    You should now be able to browse the GAC directory.


  1. Create a break point.

  2. Do an IIS reset, cos 90% of the time if you don't you'll crash IIS and VS.

  3. Open a SharePoint page you know uses the dll

  4. Attach the w3wp.exe process with your application user id to the debugger.

  5. Interact with the page until you reach your break point.


Virutal PC (VPC) jerky cursor

The reality of working with sharepoint is that you need to use a virtual pc running win2003/2008.

My preference has always been for VMWare, and VMWare 6.0 really wipes the floor with MS Virtual PC.

Unfortunately sometimes I am forced to work with VPC, and one of the things that really bugged me was a jerky cursor... searching google didn't help much so I figured it would be something to do with the graphics (after changing a reg setting to increase resolution of the mouse and noticing other jerkiness), and sure enough I eventually found it.

Fix: On a VPC with Win2003 go to Display Properties > Settings > Advanced > Troubleshoot slide the hardware acceleration all the way to Full.