简体   繁体   中英

Sharepoint Check In Rest API Error 'Not well formatted JSON stream'

The same Check In Rest API working in Sharepoint provider hosted low trust app but in High trust app it gives Error 'Not well formatted JSON stream'

    <!-- language: lang-js -->
    var spUrl = appweburl + "/_api/SP.AppContextSite(@target)/web/getfilebyserverrelativeurl('" + fnGetServerRelPath(sFileRef) + "')/checkin(comment='Check-In',checkintype=0)?@target='" + hostweburl + "'";
     var executor = new SP.RequestExecutor(appweburl);
     executor.executeAsync({
                            url: spUrl,
                            method: "POST",
                            headers: { "Accept": "application/json; odata=verbose" },
                            binaryStringResponseBody: false,
                            success: function (data) { },
                            error: function (data) { fnUpdateFileFailure(data) },
                            state: "Update"
                });

I Just change the header and it works for me !

headers: {
          "X-HTTP-Method": "PUT", 
           "accept": "application/json; odata=verbose" 
         },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM