3

I am trying to save a list item via REST and sending following piece to SharePoint API:

        var updatedTaskInformations = {
            "__metadata": {
                "type": "SP.Data.TasksListItem"
            },
            "Status": "Completed",
            "PercentComplete": 1,
            "Description": comment
        };

But I only receive this message:

The property 'Description' does not exist on type 'SP.Data.TasksListItem'. Make sure to only use property names that are defined by the type.

But the tpe exists and the Column Description does also exists.

Is this column read-only for REST API or is it just not visible to REST API?

4

You need to use the internal name of column. In Tasks lists, the internal name is Body

Try it as below:

var updatedTaskInformations = {
            "__metadata": {
                "type": "SP.Data.TasksListItem"
            },
            "Status": "Completed",
            "PercentComplete": 1,
            "Body": comment
        };
  • ooohhh, okay. That should be the answer. Thanks man! – Snickbrack Feb 22 '17 at 9:18
  • 1
    Its Body in Tasks lists and I think Description in the IssueList. To find the internal info; you need to understand SharePoint so you know what to browse/look for with this great Chrome Browser Extension "SharePoint Insider" ► chrome.google.com/webstore/detail/sharepoint-insider/… (similar to tools like Bram de Jagers's SharePoint Client Browser and many others) – Danny '365CSI' Engelman Feb 22 '17 at 9:27
2

I post this as a note to anyone who googles their way here. (Not enough rep to add a comment.)

If your custom List names, or the names of their custom fields contain spaces, SharePoint replaces them in the internal name with:

_X0020_

To determine what the internal names are, paste the following into the address bar of your browser and use Ctrl-F to search the XML that is returned for your field's display name (change the bold, below, for your site's name, individual page, and for your list's display name):

mySite.com/sites/myPage/_api/web/lists/getbytitle('My Custom List')/Fields

EG: "First Name" becomes "First_x0020_Name" when populating your JSON request

Hope this helps.

  • Adding that column names over 32 characters will have their internal names truncated to 32 characters. – ElliotSchmelliot Jun 13 at 18:57

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.