0

In order to do some migration I have to read several lists from my SharePoint from the client (I do not have access to the server console). So far fo rmost lists this worked pretty well but now im at the MicroFeed and I get an unknown (literally) error when trying to load its items. Im using the following code right now

var onItemsLoaded = function() {

}

var onFieldsLoaded = function() {       
    this.clientContext.load(this.feed.getItems());
    this.clientContext.executeQueryAsync(Function.createDelegate(this, onItemsLoaded),    function(sender, err) { console.log(err); });
}

var onListsLoaded = function() {
    var enumerator = this.lists.getEnumerator();
    while(enumerator.moveNext()) {
        var cur = enumerator.get_current();
        if(cur.get_title() == "MicroFeed") {
            this.feed = cur;
            this.clientContext.load(this.feed);
            this.clientContext.executeQueryAsync(Function.createDelegate(this, onFieldsLoaded));
            break;
        }
    }
};

ExecuteOrDelayUntilScriptLoaded(function() {
    this.clientContext = new SP.ClientContext.get_current();
    if (this.clientContext != null) {
        this.web = this.clientContext.get_web();
        this.lists = this.web.get_lists();
        this.clientContext.load(this.lists);

        this.clientContext.executeQueryAsync(Function.createDelegate(this, onListsLoaded),
        function() {

        });
    }
}, "sp.js");

So far for other lists this code worked well, but for the MicroFeed i get the following error in the executeQueryAsync inside onFieldsLoaded "Microsoft.SharePoint.Client.UnknownError"

I traced that as soon as i call feed.getItems every subsequent load that somehow includes feed or any of its elements (but not the actual result of feed.getItems) i get this error. If i remove the call to feed.getItems everything is fine again, but i obviously cannot access the elements of the MicroFeed.

0

this.feed.getItems() needs a CamlQuery as parameter which items to retrieve. Unlike what i thought this parameter is not optional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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