i developed a custom Upload-Form to be able to upload a local file and pre-populate Metadata Fields at once. So the file will be uploaded to a document library and specific meta data fields will be set.

I followed as Rob described here:

Properties when uploading Files using REST in SP 2013

Uploading the Document works fine. Getting the Item Returns "200 OK" and I have checked the Response in Detail. Everything ok here. But the metadata is not updated, nor do I see an error message.

    var call = uploadDocument(buffer, fileName);
    call.done(function (data, textStatus, jqXHR) {
        var call2 = getItem(data.d); // From here i can see that getItem and so data.d is fine!
        call2.done(function (data, textStatus, jqXHR) {
            var item = data.d;
            var call3 = updateItemFields(item);
            call3.done(function (data, textStatus, jqXHR) {
                var div = jQuery("#message");
                div.text("Item added");
            call3.fail(function (jqXHR, textStatus, errorThrown) {
                failHandler(jqXHR, textStatus, errorThrown);
    call2.fail(function (jqXHR, textStatus, errorThrown) {
            failHandler(jqXHR, textStatus, errorThrown);
    call.fail(function (jqXHR, textStatus, errorThrown) {
        failHandler(jqXHR, textStatus, errorThrown);

Does anybody know how to identify what's missing here?

1 Answer 1


After two nights of Research and Debugging, i can tell that the jQuery promises in Version 1.10.2 are not working properly. At least i used $.when(..).then(..).then(..).done(...) with no luck in runtime but sometime in a debug-session it worked to the 2nd chain, never to the last.

You may find this interesting: https://gist.github.com/domenic/3889970

I then decided to use code behind and that works like a charm with even less code.

  • Hi Ronny, it would be terrific if you could add the code you used :) Feb 26, 2014 at 14:47
  • Hi Robert, for some reason I never got an notification about your question. Are you still interested in that Piece of Server Code?
    – Ronny
    Dec 13, 2017 at 14:16

Your Answer

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

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