0

I have a problem updating lists from my Office-365 sharepoint hosted app. My SPServices call can update a list inside my site, but when I webURL back (prune the path) to the site collection, I can read lists but cannot update them. I have permissions set to full control for sitecollections and I know the SPService code works when webURL is removed and I point to local lists (not at the site collection level).

When attempting to update records the response is "success" but internal soap has all the records unmodified and the error message is ErrorCode = 0x81020077 and ErrorText = "Could not access server"

Gotta be some permission issue I'm not understanding.

The code below works when I am updating lists from my app in my little "bubble" that gets created when my sharepoint hosted app is deployed in 365. When I turn on sitecollection permission I can then access lists outside my bubble and view all lists. But I can't update them with the same code (I simply add a webURL and change the listname).

$().SPServices({
       operation: "UpdateListItems",
       webURL: "/sites/steve/",  // The list we want is here...
       listName: "foo",          // generic list.
       updates: "<Batch OnError='Continue' PreCalc='TRUE'>" +
               "<Method ID='1' Cmd='New'>" +
               "<Field Name='Title'>Hello World</Field>" +
               "</Method>" +
               "</Batch>",
       completefunc: function (xData, Status) {
            // Handle Network exception...
            if (Status.toLowerCase() == "error")
                throw CXX.CreateExceptionCNetError(xData.responseText, xData.status, xData.statusText);
            // so far so good, now we examine the soap data...
    }
});

Is this a rule for hosted apps (javascript only) that modifications to sitecollection lists is not supported?

Thanks!!!

2 Answers 2

1

Steve, I still think that the URL you are providing in the webURL is not a site URL (maybe a sub folder URL?)... If you have permissions and you are not jumping domains or protocol...

can you use this on each of the URL's you are feeding the UpdateListItems and ensure you have correct site URL's:

$().SPServices({
    operation: "WebUrlFromPageUrl",
    pageURL: "YOUR SITE URL HERE",
    completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function() { 
               alert( "SITE webURL should be: " + $(xData.responseXML).find("WebUrlFromPageUrlResult").text() );
   }
});
0

Can you post your SPServices call for one that works and one that does not. Please include the value of the webURL.

Also, have you looked at the network traffic? Anything strange about the message that is failing?

1
  • Sure, this code below works when I am updating lists from my app in my little "bubble" that gets created when my sharepoint hosted app is deployed in 365. When I turn on sitecollection permission I can then access lists outside my bubble and view all lists. But I can't update them with the same code (I simply add a webURL).
    – Steve
    May 30, 2013 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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