Monday, November 8, 2010

How To Referencing the JavaScript Client Object Model

The following are simple steps to show how you can hooks your SharePoint page with JavaScript Client Object Model:

  1. From the Site Actions menu, choose New Page. Name the new page JSClientObjectModelTest.
  2. From the Page tab in the ribbon, click Save.
  3. Also from the Page tab, click the arrow under the Edit button and select Edit In SharePoint Designer.
  4. In SharePoint Designer, from the Home tab on the ribbon, select Advanced Mode.
  5. In the Content control with the ID PlaceHolderAdditionalPageHead, add the following markup after the SharePoint:RssLink tag (on one line):

    <SharePoint:ScriptLink runat="server" Name="sp.js" Localizable="false" LoadAfterUI="true"/>

  6. Scroll to the bottom of the page, and before the WebPartPage:WebPartZone tag, add the following markup (on one line):

    <script type="text/javascript" src="../SilverlightControls/JScriptTest.js" ></script>
    <div id="DemoConsole"></div>

  7. Click the Save icon in the upper-left corner of the window to save the changes to SharePoint. Click Yes in the Site Definition Page Warning.

For more information on Silverlight and JavaScript Client Object Model, see below:

No comments: