I'm working on a Sharepoint hosted App, that accesses List Data from the Hostweb as I outlined here: EventListener for List changes in Sharepoint Hosted app
I want to use the
GetListItemChangesSinceToken method as mentioned by Sean in the answer of the question I linked above.
Now, it seems that I get the first request working and the raw answer to the
POST looks quite good (sending a token as
null value gives me a fresh token and a lot of list data).
But somehow the
executeQueryAsync() method always calls the
errorHandler method and returns this error message:
Unexpected response from server. Even though the
POST answer looks fine.
So here is my code so far:
// get all the needed contexts and web for accessing the hostweb // (this part is definitely working) var hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl")); var clientContext = new SP.ClientContext.get_current(); var hostContext = new SP.AppContextSite(clientContext, hostweburl); var web = hostContext.get_web(); var list = web.get_lists().getByTitle("My List Title"); // create Query var cliQuery = new SP.ChangeLogItemQuery(); cliQuery.set_changeToken(null); // apply getListItemChangesSinceToken to list and execute query list.getListItemChangesSinceToken(cliQuery); clientContext.executeQueryAsync(successHandler, errorHandler);
Am I doing something obviously wrong?
Thanks in advance!