0

I'm using below code to update multiple lookup fields of document library

Code:

var itemProperties = { '__metadata': { "type": "SP.Data.WP_x005f_DocumentsListItem" }, 'Technology_StackId': { "results": [1,2] }} // multi-valued field }

$.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")",
        type: "POST",
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(itemProperties),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "X-HTTP-Method": "MERGE",
            "If-Match": '*'
        },
        success: function (data) {
            success();
        },
        error: function (data) {
            failure(data);
        }
});

It is throwing below error:

A type named 'SP.Data.WP_x005f_DocumentsListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type

Can someone please help me with this?

  • can you check SP.Data.WP_x005f_DocumentsListItem is correct? You can find by a GET request to /_api/Web/Lists/getbytitle('List Name')/ListItemEntityTypeFullName – Atish Dipongkor - MVP Jul 21 '16 at 11:53
  • i have checked that it is correct – Rahul Dayal Jul 21 '16 at 11:53
  • This error is only related to ListItemEntityTypeFullName as far as I know nishantrana.me/2013/10/03/… – Atish Dipongkor - MVP Jul 21 '16 at 11:58
  • ya also know that but not able to update the field – Rahul Dayal Jul 21 '16 at 11:59
  • Is it happen for this column only? Can you update other column except this – Atish Dipongkor - MVP Jul 21 '16 at 12:03

Your Answer

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

Browse other questions tagged or ask your own question.