1

I've looked this post to build CRUD process using JavaScript via REST OData. I've have managed it for Risks and Issues list. But, I haven't succeeded for Tasks item. What's the difference between Risks or Issues with Tasks (REST URL or others)?

I got an error when trying to update the Tasks:

{"error":{"code":"-2130575223, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"This list is currently being managed by Project Web App, and cannot be edited directly"}}}

  • Are you getting any eoor? – Aanchal Oct 14 '14 at 6:42
  • I got Bad Request (400) or Internal Server Error (500) – andrefadila Oct 14 '14 at 7:04
  • post your Url Request – Nk SP Oct 14 '14 at 8:48
  • There is most likely a error message, which you can print to console or similar. If you use say Chrome you can view the response body in Network-tab (dev tools) – eirikb Oct 14 '14 at 12:24
  • I got an error: {"error":{"code":"-2130575223, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"This list is currently being managed by Project Web App, and cannot be edited directly"}}} What's the meaning? – andrefadila Oct 17 '14 at 6:00
0

I would recommend you to get acquainted with the article Manipulating list items in SharePoint Hosted Apps using the REST API. In my opinion it is one of the best articles so far that describes how to consume SharePoint 2013 REST service in JavaScript to perform CRUD operations with list items.

Let me demonstrate you the example of creating Task item.

For that purpose let's reuse the function for creating List Item from the mentioned article:

function createListItem(webUrl,listName, itemProperties, success, failure) {

    $.ajax({
        url: webUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
        type: "POST",
        processData: false,
        contentType: "application/json;odata=verbose",
        data: JSON.stringify(itemProperties),
        headers: {
            "Accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val()
        },
        success: function (data) {
            success(data.d);
        },
        error: function (data) {
            failure(data);
        }
    });
}

Note: I've added some modifications in order to specify list item properties via function parameters

Then, the following example demonstrates how to create Task item

//Create a task item
var taskProperties = {
    'Title': 'Order Approval', 
    '__metadata': { 'type': 'SP.Data.TasksListItem' }
};


createListItem(_spPageContextInfo.webAbsoluteUrl,'Tasks',taskProperties,
  function(item){
    console.log('Task "' + item.Title + '" has been created successully'); 
  },
  function(error){
    console.log(error.responseText);
  }
);

To summarize, in your case the error probably occurs due to

  • missing or incorrect entity type name
  • incorrect list item property name or value
  • I got an error: {"error":{"code":"-2130575223, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"This list is currently being managed by Project Web App, and cannot be edited directly"}}} – andrefadila Oct 16 '14 at 8:28
0

My last project using this library to update Tasks not using REST because Tasks was protected by PWA. I hope it can solve your problem.

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.