Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

Update list item metadata via REST from sharepoint hosted app

$
0
0

using this code from

function updateListItem(itemId, listid, listName, siteUrl, itemProperties, success, failure) {
    var itemType = GetItemTypeForListName(listName);
    itemProperties["__metadata"] = { "type": itemType };
    //getListItemWithId(itemId, listid, siteUrl, function (data) {
    debugger;
    getListItem(hostweburl,listname, itemId,function (data) {
        var exec;
        exec = new SP.RequestExecutor(appweburl);
        debugger;
        exec.executeAsync({
            url: data.d.__metadata.uri,
            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": data.d.__metadata.etag
            },
            success: function (data) {
                success();
            },
            error: function (data) {
                failure(data);
            }
        });
    }, function (data) {
        failure(data);
    });
}
I can get the list item however when I use the uri from the metadata property I am getting

value=List does not exist.

The page you selected contains a list that does not exist.  It may have been deleted by another user.

Any ideas?

thx

MrP



Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>