SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the code found at under the section 'Adding a Web Part To A Page With Javascript'. However I cannot get a reference to the file SP.js. Is this found in 2007 or is it only 2010 and on?


share|improve this question

Neither the Client Object Model nor the REST API are available in SharePoint 2007. However, you can use the SOAP (ASMX) web services. If you're going to do so from JavaScript I highly recommend you use Marc Anderson's SPServices jQuery plug-in.

You said you were looking to add a web part to a page. Here are a couple resources that should help you do so using SPServices:

AddWebPart Documentation

SPServices Stories #3 – AddWebPart Method of the WebPartPages Web Service

share|improve this answer

Try adding this code at the top of the page:

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


share|improve this answer
That's for 2010 isn't it? – ADringer Dec 18 '12 at 9:53
Ah yes my bad, thought it was for 2007 for some reason. – ng93 Dec 18 '12 at 10:06

SP.js is a part of JavaScript Class Library in SharePoint 2010 Client Object Model (CSOM)

It is not supported to use in previous versions of SharePoint including SharePoint 2007

The CSOM acts as a proxy to connect to a WCF service (Client.svc) for the processing of the request. The Client.svc service is the protocol server responsible for performing all of the operations requested by the client object model. For more details see, for example Working with the ECMAScript Client Object Model (JSOM) in SharePoint 2010–Part 1. This kind of functionality is not available in SharePoint 2007.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.