More and more over the last two weeks, I have become increasingly amazed about two things.

First off, the good people at Microsoft that coded up the API for SharePoint 2007 (and, I hear, 2003) decided to provide either no or meaningless documentation on just about any useful object in the object model.  On any project I managed, one of my unbreakable demandments was that any public-facing function, object or object property had to have at least the default "triple-slash" XML documentation filled out in a meaningful way before it was considered done.  Maybe I've been living in a general .Net framework shangri-la for too long, but I expected at least as much from Microsoft for a platform they are pushing at the enterprise level.

Secondly, I am even more amazed at the general lack of good searchable SharePoint solutions to fairly low-level programming tasks out there on the web.  I've been through way too many examples of this in the last couple weeks, but the one that surprised me the most was one just now, when I was searching for a definition of what the ContextInfo object was in the MOSS 2007 JavaScript API.

I found lots of examples of people using the object to cobble together context menus and submenus of various shapes and sizes, but nowhere did anyone show more of the object than what they used in their code.  I suspect that the reason for this is that SP developers with any amount of time under their belt have grown used to digging through the shipped DLLs and JavaScript files on their own, looking for the knowledge they seek.

That's just nonsense.  There should be some sort of effort to make experienced .Net developers with little SharePoint experience a little more at ease.  So, I'm taking it upon myself to start posting any bits of information I find that will soon seem "obvious" to me as well as I travel down the MOSS path... but just as it wasn't obvious to me in the past, it won't be obvious to new developers coming behind.

Now, without further adieu, the goods:

The structure of the SharePoint ContextInfo object, as found in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\core.js on a default MOSS 2007 install:

function ContextInfo()
{
    this.listBaseType=null;
    this.listTemplate=null;
    this.listName=null;
    this.view=null;
    this.listUrlDir=null;
    this.HttpPath=null;
    this.HttpRoot=null;
    this.serverUrl=null;
    this.imagesPath=null;
    this.PortalUrl=null;
    this.RecycleBinEnabled=null;
    this.isWebEditorPreview=null;
    this.rootFolderForDisplay=null;
    this.isPortalTemplate=null;
    this.isModerated=false;
    this.recursiveView=false;
    this.displayFormUrl=null;
    this.editFormUrl=null;
    this.newFormUrl=null;
    this.ctxId=null;
    this.CurrentUserId=null;
    this.isForceCheckout=false;
    this.EnableMinorVersions=false;
    this.ModerationStatus=0;
    this.verEnabled=0;
    this.isVersions=0;
    this.WorkflowsAssociated=false;
    this.ContentTypesEnabled=false;
    this.SendToLocationName=""
    this.SendToLocationUrl=""
}

You'll have to figure out what they all mean, I only found it just now myself - but most of them seem pretty self-explanatory (about time something did).


Creative Commons License This work is licensed under a Creative Commons License.