Information Risk Management: 

Microsoft Office 365, Microsoft Teams, Microsoft SharePoint Server, Microsoft SharePoint Online, Microsoft Exchange Online, Azure DevOps & App Services, Azure Machine Learning

CAML.NET Intellisense for SharePoint 2010

John Holliday

November 3, 2010

Table of Content

camelWell, I finally gone and done it!   The CAML.NET IntelliSense Extension for Visual Studio 2010 is finally out in the wild, so have at it you crazy SharePoint devheads!

For those of you already using the SharePoint 2007 version, you know the basic idea.  Extend the default CAML schema files with detailed annotations imported from the SharePoint SDK documentation so you get more information at your fingertips while editing CAML files.

But there were limitations on the amount of information you could get to show up in the Visual Studio 2008 IntelliSense tooltips.  I really wanted to include rich HTML with links and formatted scrolling text so you could basically have as much information as you need right there at your fingertips while coding.  So much better than interrupting your train of thought to go browsing through the online docs, right?

Enter Visual Studio 2010 and the simply wonderful Extension Manager.  I mean, this stuff is so cool it makes you want to quit fooling around with SharePoint and switch over to developing Visual Studio extensions full time.  (… NOT!)  But seriously, the VSIX framework really is kind of cool.  Combine that with WPF and you’ve got the makings of a really powerful tool for editing CAML files.

So, for the last 6 months or so, I’ve been working on an updated version that would take full advantage of the VSIX framework.  Here are the main features:

  • Extends the default schema files with detailed annotations imported directly from the SharePoint SDK documentation.  This is similar to the 2007 version, but way cooler.
  • Adds a custom WPF IntelliSense Presenter to the Visual Studio environment for a greatly enhanced developer experience.
  • Automatically detects and downloads schema updates so you are always working with the most current information available.
  • Links directly to the online SDK documentation for the currently visible element, so you can “drill down” into the documentation with a single click.  If no documentation link is available, it does a Bing search for the highlighted topic, which opens in the Visual Studio web browser.

You can download it directly from the Visual Studio Gallery on MSDN here.

Annotated Schemas for Richer Intellisense

The main idea behind CAML.NET Intellisense is to extend the core WSS schemas in two ways:

  1. Add as much information as possible about each element and attribute using xs:annotation elements so that it pops up in context while editing; and
  2. Identify and replace xs:string types in the schema with enumerated types so that the valid values for each attribute also popup in context while editing.

For example, using the out-of-the-box WSS schema that ships with SharePoint 2010, you get a drop-down like the following when editing a Feature element:

Rudimentary Intellisense for CAML editing

That’s better than nothing, of course, but it doesn’t say anything about what each Feature attribute is for, so unless you’re already familiar with it, you’d have to refer back to the SDK either online or in the CHM file. Kind of a drag, since you’ve got the list of valid attributes right in front of you. If you’re like most developers, this can be a real distraction because you tend to get lost in the details while searching for the information online when you should be busy coding your solution.

Instead, by using the annotated WSS schema provided by CAML.NET Intellisense, you can see the information you need right there in context. You only have to refer to the SDK documentation when you really need to learn more about the topic. Most of the time, you just need a hint, which is what Intellisense is all about, right?

New Enhanced IntelliSense Presenter

With all of the great new WPF-based enhancements that Microsoft has added to the Visual Studio 2010 user experience, why not take advantage of the improved extensibility layer and add a custom IntelliSense Presenter just for SharePoint? After all, some of the SDK descriptions of CAML elements are rather lengthy and get kind of hard to read in just a single line of text.

The CAML.NET Intellisense Presenter gives you a nifty way to get all that WPF goodness right where you need it most. Here’s an example of what you get while adding a FieldRef element to a ContentType:

Editing a FieldRef Element

Extending the Core Schemas with Enumerated Types

In addition to annotating the schemas with the corresponding SDK documentation for each element, we can go one step further and change the plain vanilla xs:string types to custom enumerated types so we get the list of valid choices for the attribute values. This comes in very handy and also helps to eliminate those nasty little typos that can be *really* hard to find (and the SharePoint CAML gets mighty snippy about).

There are lots of places in the SDK documentation where the expected attribute values are listed in the description, but are not enumerated in the schema. This again means that you’d have to go digging through the documentation to discover what SharePoint expects the attribute values to be. This can be an enormous waste of time – even if you have a pretty good idea of what the values are. Who can keep all that detail in their head?

So, CAML.NET Intellisense enumerates as many attribute values as possible so they are available at your fingertips when you need them. Each enumeration is also annotated, so you get contextual help for the available values.

Here’s another example that shows the enumeration of list template types when adding a ListInstance element to a Feature. This can be a huge time saver! How many times have you had to hunt down the table of available list template type identifiers?


Link Back to the SDK Whenever You Need To

Microsoft has invested heavily in new and improved online SDK documentation, so I thought why not link back directly to the SDK so you can drill down whenever you need to? Sometimes you just need a little hint, but at other times, you need more detail. CAML.NET Intellisense gives you the best of both worlds. Simply click the magnifying glass icon. If there is an SDK topic for the current item, it is displayed in the Web Browser tool window. If not, then it executes a web search for more information about the topic being displayed.

MSDN Search

Stay Up To Date on the Latest Best Practices

As we all know, things change fast in our industry.  There are always new ideas, new approaches to stay on top of, new techniques for dealing with the many issues that can arise unexpectedly.

I pondered quite a bit on this one, but I felt it was very important to have a way for the extension to update itself automatically whenever new “best practices” become widely accepted.  Also, the MSDN documentation is extensible with community content.  Some of that content helps to clarify and add critical detail for various CAML tags and attributes.  I wanted a reliable way to make that information show up automatically in context, so that SharePoint developers don’t have to go looking for it.

With the extension installed, the customized SharePoint schema files are updated automatically (if a new version is available) whenever you startup the Visual Studio environment.   That way the schema authors (myself and a few dedicated MVPs) can regularly scan the SharePoint SDK and online SharePoint community resources and push new information out through the schema file.  This makes it easier for you to find the information you need, and puts it literally right at your fingertips.

Available Now from the Visual Studio Gallery

You can download the new version directly from the Visual Studio Gallery on MSDN.

Best of all, it’s free.  Free as the desert sand!  So what are you waiting for?  Get ready to ride!  Ride that CAML!  Yeah!


I’m just so excited it’s finally out there.

As always, your comments are welcome.

Faster.  Better.  Like a dromedary!

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on print