Enabling IntelliSense for the JavaScript Client Object Model in SharePoint 2010

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!

Enabling IntelliSense for the JavaScript Client Object Model in SharePoint 2010

Full article on MSDN available here.

Enjoy!

Comments

  1. Paul Lawrence says

    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?

    • says

      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

  2. says

    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" />

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>