0

I execute this function updatemainop() in my script:

function updatemainop() {
    var itemType = GetItemTypeForListName('MainOperation');
    var query = applink + "_api/SP.AppContextSite(@target)/web/lists/getbytitle('MainOperation')/items(125)?&@target='" + hostweblink + "'";

    var meta_data = {"__metadata": { "type": itemType }, "AMOUNTBUDGET": 1500};
    var executor = new SP.RequestExecutor(applink);

    executor.executeAsync({
        url : query,
        method : "POST",
        body: JSON.stringify(meta_data),
        headers: {
            "Accept": "application/json;odata=verbose",
            "Content-Type" : "application/json;odata=verbose",
            "X-HTTP-Method": "MERGE",
            "IF-MATCH": "*"
        },
        success: function (data) {
            console.log(JSON.stringify(data));
        },
        error: function (err) {
            console.log(JSON.stringify(err));
        }


       });
      }

but I have this error :

"NetworkError: 404 NOT FOUND - https://mycompany-b10b99295a3aa7.sharepoint.com/sites/mysite/myproject/SP.AppContextSite(@target)/web/lists/getbytitle('MainOperation')/items(125)?&@target=%27https://mycompany.sharepoint.com/sites/myproject%27" items(1...CLAUSE' {"responseAvailable":true,"body":"404 NOT FOUND","statusCode":404,"statusText":"NOT FOUND","contentType":null,"allResponseHeaders":"Cache-Control: private,max-age=0\r\nContent-Length: 13\r\nExpires: Tue, 23 Aug 2016 08:27:54 GMT\r\nAccept-Ranges: bytes\r\nServer: Microsoft-IIS/8.5\r\nX-SharePointHealthScore: 0\r\nPublic-Extension: http://schemas.microsoft.com/repl-2\r\nSPRequestGuid: f85ea19d-70bc-3000-b229-65ed29d0e1fe\r\nrequest-id: f85ea19d-70bc-3000-b229-65ed29d0e1fe\r\nStrict-Transport-Security: max-age=31536000\r\nX-Frame-Options: SAMEORIGIN\r\nSPRequestDuration: 123\r\nSPIisLatency: 4\r\nX-Powered-By: ASP.NET\r\nMicrosoftSharePointTeamServices: 16.0.0.5701\r\nX-Content-Type-Options: nosniff\r\nX-MS-InvokeApp: 1; RequireReadOnly\r\nP3P: CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"\r\nDate: Wed, 07 Sep 2016 08:27:53 GMT\r\n","headers":{"CACHE-CONTROL":"private,max-age=0","CONTENT-LENGTH":"13","EXPIRES":"Tue, 23 Aug 2016 08:27:54 GMT","ACCEPT-RANGES":"bytes","SERVER":"Microsoft-IIS/8.5","X-SHAREPOINTHEALTHSCORE":"0","PUBLIC-EXTENSION":"http://schemas.microsoft.com/repl-2","SPREQUESTGUID":"f85ea19d-70bc-3000-b229-65ed29d0e1fe","REQUEST-ID":"f85ea19d-70bc-3000-b229-65ed29d0e1fe","STRICT-TRANSPORT-SECURITY":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","SPREQUESTDURATION":"123","SPIISLATENCY":"4","X-POWERED-BY":"ASP.NET","MICROSOFTSHAREPOINTTEAMSERVICES":"16.0.0.5701","X-CONTENT-TYPE-OPTIONS":"nosniff","X-MS-INVOKEAPP":"1; RequireReadOnly","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","DATE":"Wed, 07 Sep 2016 08:27:53 GMT"}}

0

If you are receiving a 404 NOT Found http error code most likely your URL formation was not correct. From the error message it appears that you are trying to reach a site /sites/myproject in your hostweblink variable. Are you sure you have such a site or did you intend to reach /sites/mysite/myproject?

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.