none
Read Data from Sharepoint in a office app RRS feed

  • Question

  • Hello

    I'm trying to read some data from a sharepoint 2013 list in an office task pane.
    I tried connecting with the javascript CSOM, with no success. The code is:

    $(document).ready(

    function () {
        hostweburl = hosturl;
        appweburl = appweb;

        var scriptbase = hostweburl + "/_layouts/15/";

        $.getScript(scriptbase + 'SP.Runtime.js',     

     function () {$.getScript(scriptbase + 'SP.js',          
     function () { $.getScript(scriptbase +
     'SP.RequestExecutor.js', registerContextAndProxy)})
     });

     });

         function registerContextAndProxy() {
             context = new SP.ClientContext(appweburl);
             var factory = new SP.ProxyWebRequestExecutorFactory(appweburl);
             context.set_webRequestExecutorFactory(factory);

             //...

         }


    SP.ClientContext is undefined.

    Thanks for your help. Regards

    Mike

     

    Friday, September 28, 2012 1:20 PM

Answers

All replies

  • Did you try substituting in values for "appweb" and "hosturl"?

    Which line is throwing the exception?


    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Monday, October 1, 2012 1:36 AM
  • Hi Mike

    Thanks for your answer.

    The url's seem to be ok. It's the line:

    context = new SP.ClientContext(appweburl);

    ClientContext is undefined, as if not loaded yet?

    If I run the code in a sharepoint app (slightly modified, SP.ClientContext.get_current(), no ProxyWebRequest...), all works fine.

    Regards

    Mike

    Monday, October 1, 2012 7:26 AM
  •  context = SP.ClientContext.get_current();
            web = context.get_web();

    This Works for me.


    Robert Stark Aurora Sky Technology Partners www.auroraskytech.com robert@aurorskytech.com

    Wednesday, November 28, 2012 10:27 PM