Author Archive

Custom URL Field Types

Wednesday, April 23rd, 2008

Just a quick note on something that had me scratching my head for a couple of hours this afternoon. The task was to create a new custom field type that is based on the SPFieldUrl class. Although my fldtypes_*.xml file *looked* correct it wouldn't load. It turned out that the ParentType property value is both case-sensitive, and inconsistent. Whereas for a field that derives from SPFieldText you use set the property to "Text", if the parent type is an SPFieldUrl, you need to set the ParentType property to "URL" (all upper-case)!

So:

<FieldType>...<Field Name="ParentType">Url</Field>...</FieldType> is WRONG

<FieldType>...<Field Name="ParentType">URL</Field>...</FieldType> is RIGHT

 Gah!
 

Getting the Creator of a List Item

Monday, March 24th, 2008

In some code I've been recently writing, one of the more tricky issues has been retrieving the identity of the user who created a list item. There is nothing on the SPListItem class or any of its base classes and in fact buried in the documentation is this snippet of code:

string userValue = listItem["Assigned To"];
int index = userValue.IndexOf(';');
int id = Int32.Parse(userValue.Substring(0, index));
SPUser user = site.SiteUsers.GetByID(id);

…with a note to say that you can use this to also get the Author and Editor fields.

But this is misleading in three respects:

  1. The field containing the creator of the list item appears to be *either* "Created By" *or* "Author".  
  2. The indexer returns an object, not a string, so you have to cast the return value in the first line to a string.
  3. In some cases the "Created By" field is null (appears that this may be a time-based issue and that immediately after creation the "Created By" field may not be set, so you need to defend against a null value coming back from the field.

So my code ended up being:


string creator;
object oCreator = item["Created By"];
if (oCreator != null)
{
  creator = oCreator.ToString();
}
else
{
  oCreator = item[
"Author"];
  if (oCreator != null)
  {
    creator = oCreator.ToString();
  }
}

if
(creator != null)
{
  // Do stuff with the creator string
}

Semantic Linking In SharePoint

Monday, March 3rd, 2008

Today my company, NetworkedPlanet announces the 3.0 release of our TMCore SharePoint Module for MOSS 2007. Its been a long slog to get there but I'm pretty proud of what we have achieved with this release. Because the name doesn't exactly give much away, I'll just briefly describe what the software does here – you can always read more at our website if you are interested.

At its core, the SharePoint Module adds semantic linking to SharePoint. This goes beyond the simple list to list references that SharePoint allows in a couple of ways. Firstly, you can create links between SharePoint items regardless of where they are located in the portal. Secondly you can create links from SharePoint items to concepts that do not have any direct SharePoint representation. In many other products, this second feature is called "classification against a taxonomy" and certainly that is one of the things for which this feature is useful, but with the underlying structure of the TMCore SharePoint Module you don't necessarily have to stop at a straight taxonomic tree. Driving the whole linking/classification scheme is an ontology, that is a specification of the types of things and types of relationships between things that define the business domain. The ontology governs what types of links users are allowed to make and specifies what the meaning (semantics) of those links actually are. Unlike HTML links, these links also work in both directions so making a semantic link from a "Task" list item to a "Document" list item (say "Task A requires Document B") also asserts the reverse link ("Document B is used in Task A"). The model we use is the ISO standard Topic Maps which is a well established standard for the interchange of structured knowledge models.

 All of this is very cool and of deep interest to the semantic web wonks, and user-generated content officianados, but what it means to an end user in concrete terms is:

  1. I can create links that organise the content in the SharePoint portal in ways other than the top-down tree that the site collection/site/list/item path enforces.
  2. I can see contextual links to related content without having to go searching for it and without having to know which sub-sub-sub-site it is contained in. Oh, and I never need to maintain those links – they are automatically updated as new content is created and classified.
  3. I can classify content in the portal against concepts such as projects, skills, technologies or themes that come from some external taxonomy or that I contribute to (through creating those concepts and linking them together).
  4. I can create "subject" pages that populate themselves automatically (this is really useful in web portals where these subject pages can be automatically generated hub pages in the site map that link out to all content related to that particular subject).
  5. I can use hierarchical and flat list taxonomies and even get funky with faceted classification.

If you get chance, or have a bored 15 minutes at lunchtime, check out http://www.networkedplanet.com/products/sharepointmodule/ for more information.

Visual Studio 2008 Design View Performance Bug

Thursday, February 14th, 2008

David Wise has just posted a helpful pointer to an MS Hotfix for Visual Studio 2008 that addresses the performance of the HTML editor's design view. I haven't made the switch to VS2008 yet but its on the horizon so worth bookmarking.

Pleased to meet you…

Friday, February 1st, 2008

Introductions

So, its always good form to at least introduce yourself before starting to rant deliver informed opinion.

I'm Kal Ahmed, I am the co-founder of a company based in the UK called NetworkedPlanet and we use a technology called Topic Maps to help organisations organize content and knowledge in a seamless manner. I'll mention a bit more about topic maps and how we believe they can add an important missing part to SharePoint in future posts.

This Blog

Seeing as how this blog is on SharePointBlogs (thanks Dustin!), this blog is focussed more on :

  1. Mixing KM and content management in SharePoint – in other words trying to make SharePoint a more effective tool for knowledge management and to some degree for social networking too.
  2. My day-to-day work developing our MOSS2007 and tips/tricks I've picked up along the way
  3. Stuff I find useful in doing MOSS2007 development work (mostly from the rest of the SharePoint developers' community).
  4. The occassional rant (it wouldn't be a blog otherwise).