This project has moved and is read-only. For the latest updates, please go here.

Office365 (sharepoint online) compatibility?

Dec 9, 2013 at 4:11 PM
We have used SPServices in the past with O365 by embedding a script in a page.

Trying it in our current site and I can't it to work. SPGetCurrentSite() even fails.

We're trying to add a list item based on a button click. In the completeFunc, status = 'error' and xData.responseXML is null.

Script is really simple:
    <script type="text/javascript" src="/SiteAssets/scripts/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="/SiteAssets/scripts/jquery.SPServices-2013.01.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            //$('#outputdiv').append('<b>Current site:</b> ' + $().SPServices.SPGetCurrentSite() + '<br>');
            $('#btnAddItem').click(function () {
                CreateNewItem("Testing add item");

        function CreateNewItem(subject) {
            $('#outputdiv').append('CreateNewItem() called. Subject: ' + subject + '<br />');
                operation: "UpdateListItems",
                async: false,
                debug: true,
                batchCmd: "New",
                listName: "Issues",
                valuepairs: [["Title", subject]],
                completefunc: function (xData, Status) {
                    $("#outputdiv").append("UpdateListItems() completefunc called. Status: " + Status + "<br>");

                    if (xData) {
                        $("#outputdiv").append("xData parameter is NOT null<br>");
                        if (!xData.responseXML) {
                            $("#outputdiv").append("xData.responseXML is null<br>");
                        else {
                            var out = $().SPServices.SPDebugXMLHttpResult({
                                node: xData.responseXML
                            $("#outputdiv").append("<b>This is the output from the UpdateListItems operation:</b><br>" + out);
                        $("#outputdiv").append("xData parameter is null<br>");
    <div id="inputdiv" style="padding-bottom:15px">
        <input id="btnAddItem" type="button" value="Add an Item" style="height:40px; width: 120px">
    <div id="outputdiv" style="width:100%;height:200px;border:inset 6px blue;"></div>
Dec 9, 2013 at 4:14 PM
There's a bug in 2013.01 if you are running the code in the root site of the site collection. Might that be the case? If so, just add the webURL option, like so:
webURL: "/"
This will be fixed in the next release.

Dec 9, 2013 at 4:51 PM
Thanks, that nailed it.

So, if I want to call a method like SPGetCurrentSite() how do I use this workaround? Use "defaults" ?
Dec 9, 2013 at 5:12 PM
Yes, you could use defaults. Or you could use the current alpha, which is actually in very good shape.