mo.notono.us

Tuesday, January 29, 2008

MOSS: Rant: Pathetic Documentation

There's a running joke around the office that if you have two SharePoint references, one of them MSDN and the other a blog post, and the two differ, then the blog post must be correct.

Seriously, having been weaned on the excellent documentation for .NET and SQL Server, I must say I am VERY disappointed in the lack of documentation on MSDN for the SharePoint API and XML schemas.  MOSS is already over a year old (in its final version, 90% of the API is probably 2 years old (or older)), MS not having proper documentation for the product at this point is inexcusable.

That said, almost as bad is the lack of community involvement on the MSDN pseudo-wiki.  Surely many a SharePoint developer has figured out what is really going on behind say, the SPContentType.Hidden property, but where is the user-contributed content?  If you figure something out, and it's not documented, post it.

Labels: , , ,

Monday, January 28, 2008

MOSS: Computed Columns - Part 2: They CAN be SiteColumns, a.k.a SiteColumns CAN be "Computed"

a.k.a. the SharePoint UI fails to tell the complete story, once again.

It turns out Computed Columns can indeed be SiteColumns.  Like an idiot, when I was failing last week to create Computed SiteColumns, I gauged my success and failure by what the SharePoint Site Column Gallery (i.e. _layouts/mngfield.aspx) was telling me.

I should have remembered that SharePoint lies.  At least by omission.  My Computed Columns are indeed there in the RootWeb's Fields, they just don't show up in the Site Column Gallery, nor in the Field listing for the Edit Contant Type Page (_layouts/ManageContentType.aspx).  This really is no different from a host of OOTB SharePoint fields, like all the various Name fields, for instance.

To add a Computed SiteColumn to your ContentType you'll have to edit the content type Schema either in xml, or my preferred method, in code through the FeatureActivated method of an inherited SPFeatureReceiver class.  It'll then show up in the list of fields in the Edit Content Type page, but the field name will not be clickable.

Just one more reminder to use Carsten Keutmann's excellent (and open-source and free!) SharePoint Manager 2007 tool instead of the SharePoint UI when checking your schema code.

Labels: , , ,

Friday, January 25, 2008

MOSS: Computed Columns - Part 1: They CAN NOT be SiteColumns a.k.a. SiteColumns CAN NOT be "Computed"...

Through much trial and equal amounts of failure I have come to the following conclusion: Site Columns can NOT be of type "Computed".

More to follow.

UPDATE: See Part 2 where I figure out what's really going on.  Sorta.

Labels: , , ,

Thursday, January 24, 2008

mo.notono.us - now also on SharePointBlogs.com

I have professed my feelings for SharePointBlogs.com in the past, when their outage caused half of my search results on SharePointSearch.info to go dead, but it wasn't until my friend and colleague Jesse FitzGibbon got his own SharePointBlogs account that I got jealous inspired enough to do something about it.

So I fired off a request to Dustin Miller asking if my MOSS-related blog posts could be mirrored on SharePointBlogs.com  Yesterday I got the good word from Dustin that it's all set up, so hopefully this will be the first of many posts of mine to show up on SharePointBlogs.com  I promise that the posts will be more about SharePoint and less about me.  For a look at my old SharePoint/MOSS posts, have a look here.

Labels: , ,

Monday, January 14, 2008

Pre-stolen Idea: Scanner with Option to Add Watermark During Scan

Update! So this is already done (of course). StegMark is the name of a product that will do this and which is e.g. implemented in certain HP Scanners, among a host of other products.

Original post: There are a number of scenarios in which it may be beneficial to have a scanner automatically add a watermark to a scanned image.

Example: A scanner is used at a bank - images should be "stamped" with "Sensitive - do not distribute".  Or a date stamp should be applied, etc, etc.

Labels: ,

Friday, January 11, 2008

OLPC XO Laptop: The Wife Acceptance Factor

I was fiddling with the XO this morning, and my wife goes:

"so basically, that thing is just a web browser?"

"No, it's a full fledged computer, but with limited capacity"

"So can you load the Elmo game on it?"

"Uhm, no"

"Then Erik (age 2) is not going to like it.  If its just a web browser you should have gotten [the ASUS Eee PC].  It looks better - I don't like having that green thing sitting in the kitchen all the time."

WAF: Low

Labels: , ,

Thursday, January 10, 2008

LiveWriter: Testing CodeSnippet Plugin

Leo Vildosola has written a Code Snippet Plugin for Windows Live Writer.  It looks like it works quite nicely - here is the code from my Extension Methods Post:

/// <summary>
/// Creates a list based on the specified title, description, URL, Feature ID, template type, document template type, and options for displaying a link to the list in Quick Launch.
/// </summary>
/// <param name="listCollection">The list collection.</param>
/// <param name="title">The title.</param>
/// <param name="description">The description.</param>
/// <param name="featureId">The feature id.</param>
/// <param name="templateType">The template type.</param>
/// <param name="docTemplateType">The doc template type.</param>
/// <param name="quickLaunchOptions">The quick launch options.</param>
/// <returns>A GUID that identifies the new list.</returns>
public static Guid Add(this SPListCollection listCollection, string title, string description, string url, Guid featureId, 
    SPListTemplateType templateType, int docTemplateType, SPListTemplate.QuickLaunchOptions quickLaunchOptions)
{
    return listCollection.Add(title, description, url, featureId.ToString("B").ToUpper(), 
        (int)templateType, docTemplateType.ToString(), quickLaunchOptions);
}

(via Frank's World)

Labels: , , ,

C#/MOSS: Extension Methods: For Good and For Evil

Let me start with some good news:  C# 3.0/ASP.NET 3.5 works beautifully with SharePoint 2007, thanks to the forward-compatible nature of the .NET framework from version 2.0 onwards.

This compatibility opens up all sorts of avenues, one of them is the use of Extension Methods, replacing trusty old Utility classes.

Extension methods are amazingly simple, yet handy, essentially they allow you to "correct" the behavior of a class that you otherwise have no control over.  This can be used both for Good (adding useful methods to a poorly written API) and for Evil (making C# look like VB).  And of course it can also be used for sheer Anal Retentiveness:

For instance, I am not a fan of the SPListCollection.Add() method, especially the last two overloads.  Among other parameters these overloads take a string featureID(where the string represents a Guid), an integer templateType (where the integer represents a SPListTemplateType enum), and a string docTemplateType (where the string represents an integer).  WTF?  Why aren't these parameters in their native types?

So I created the following method inside a static class:

/// <summary>
/// Creates a list based on the specified title, description, URL, Feature ID, template type, document template type, and options for displaying a link to the list in Quick Launch.
/// </summary>
/// <param name="listCollection">The list collection.</param>
/// <param name="title">The title.</param>
/// <param name="description">The description.</param>
/// <param name="featureId">The feature id.</param>
/// <param name="templateType">The template type.</param>
/// <param name="docTemplateType">The doc template type.</param>
/// <param name="quickLaunchOptions">The quick launch options.</param>
/// <returns>A GUID that identifies the new list.</returns>
public static Guid Add(this SPListCollection listCollection, string title, string description, 
  string url, Guid featureId, SPListTemplateType templateType, int docTemplateType, 
  SPListTemplate.QuickLaunchOptions quickLaunchOptions)
{
  return listCollection.Add(title, description, url, featureId.ToString("B").ToUpper(), 
    (int)templateType, docTemplateType.ToString(), quickLaunchOptions);
}

Itch scratched. The properly typed overload now shows up in intellisense.

Labels: , , , , ,