CAML.NET Intellisense for Visual Studio 2010
The CAML.NET IntelliSense extensions for Visual Studio 2010 is simply a must-have for SharePoint developers. It can help you tame that sometimes finicky, but ever-so-essential CAML language we all know and love.
You probably already know how to add the out-of-the-box SharePoint schemas to Visual Studio so you get IntelliSense when editing your CAML files.
This is a good first step, but CAML.NET Intellisense takes it even further by adding the following enhancements:
Let’s face it – even with an up to date set of bookmarks, who wants to go searching all over the place for that missing tidbit that tells you just what that obscure attribute is for when you’re right in the middle of building the CAML for your spiffy new feature?
Annotated Schemas for Richer Intellisense
The main idea behind CAML.NET Intellisense is to extend the core WSS schemas in two ways:
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 aFeature element:
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 areal 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 needin 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 aFieldRef element to a ContentType:
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 vanillaxs: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 aListInstance element to a Feature. This can be ahuge 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 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 in the top right corner. If there is an SDK topic for the current item, it is displayed in the Web Browser tool window. If not, thenCAML.NET Intellisense executes a web search for more information about the item being displayed.