If you’re creating or editing a JavaScript file in Visual Studio and you would like some help creating Client Object Model code, you’re not alone.
It’s a little bit cryptic, but we can tell IntelliSense to include any JavaScript libraries you have on your development machine.
Simply place the following two lines at the top of your source code (watch out for line breaks!):
/// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js" /> /// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.debug.js" /> /// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.Core.debug.js" />
Then, you can get IntelliSense when you need it the most!
Full article on MSDN available here.
Enjoy!
You can leave a response, or trackback from your own site.

This doesn’t seem to include properties from the client Context object such as clientCtx.load(), or clientCtx.executeQueryAsync().
Which js file should be included for those little buggers?
Ahhh. I’d missed off SP.Core.debug.js :) try now!
joel
You are also missing a space between Server and Extensions:
///
Put in the space and it works.
Janus, many thanks for reading, and many thanks for spotting my typo! I had a missingspace in one of the two includes. You’re a complete star!. :o)
I’ve corrected it and hopefully now this should work for everyone :)
Cheers!
joel
Could not get the above tags to work or what is recommended in the MSDN article.
This works for me though:
<script type="text/javascript" src="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js" /%gt;
<script type="text/javascript" src="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.debug.js" />
<script type="text/javascript" src="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.Core.debug.js" />
Thanks Adrian!
That seems to be the approach for HTML pages that contain JavaScript.
Nice one!
joel
for *.aspx
Hi Ethan,
Check out the MSDN article here: http://msdn.microsoft.com/en-us/library/ff798328.aspx
For aspx pages and ascx user controls, you can use the first method listed on that page:
< % #if SOME_UNDEFINED_CONSTANT %>
< % #endif %>
Best of luck!
joel