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

my aim is to add a Ribbon Button which is opening a printing dialog for a selected file in a document library. I already added the Button with SP Designer and linked it with a html file which is calling the js.

The function printFile is called by the Ribbon.

function printFile() {
        //throws error
        ExecuteOrDelayUntilScriptLoaded(start, "sp.js");

function start() {
    var ctx = SP.ClientContext.get_current();
    var items = SP.ListOperation.Selection.getSelectedItems(ctx);
    var selectedItem = '';
    var itemURL;
    for (index in items) {
        //only for testing

When running i got this error:

The value of the property "ExecuteOrDelayUntilScriptLoaded" is null or undefined, not a Function object

Any idea to solve this error?

share|improve this question


ExecuteOrDelayUntilScriptLoaded(start, "sp.js");


SP.SOD.executeOrDelayUntilScriptLoaded(start, "sp.js");


share|improve this answer
also an error: "SP is undefined" – mbauer May 7 '13 at 6:50
is this document library web part on some custom application page ? it is obvious that you have issue with reference to sp.js ... core sharepoint Javascript client object model cannot be called from .html page if this is what you are trying .. for anything else you would have to write custom web service .. try adding this .. <script type="text/ecmascript" src="/_layouts/SP.Core.js"></script> – displayName May 7 '13 at 7:15
didn't work. it is a standard document library on a site. is there another way to access the sp.js. i only have visual studio 2012 web express and no direct access on the sp server. – mbauer May 7 '13 at 7:42
sp.js should be loaded by default in SP2010. So you do probably not need the ExecuteOrDelay there, since its executed when a user clicks it. By then everything should be loaded – Anders Aune May 7 '13 at 7:52
you should describe all the steps you took .. where you put this code .. i tried your code and it works .. – displayName May 7 '13 at 8:45

can you please try This link .

Please update if working as I am also facing same challenge.
My developement: using VS 2010 add ribbon button as a feature and call Javascript. refer This Link


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.