1

I'm currently building a SharePoint Hosted App which gets any task list items from various sites and pushes them into an array. I'm using AngularJS to make these requests. Running a GET request on a task item returns the property 'Checkmark' which strangely is a string ("0" = Unchecked, "1" = Checked), I'm able to use this to get all unchecked items.

The difficulty is when the user clicks the checkbox on the app, I want to then update the checkmark property for the item. The HTTP POST request is as follows:

var checkedData = JSON.stringify({ "__metadata": { "type": "SP.Data.TasksListItem" }, "Checkmark": task.Checkmark.toString() });
$http.post(url, checkedData, {
    headers: {
        'X-HTTP-Method': 'MERGE',
        'content-type': 'application/json;odata=verbose',
        'X-RequestDigest': requestDigest,
        'IF-MATCH': '*'
    }
})

However this doesn't update the checkmark property. If I change "Checked" to "Title" in the POST body then the Title changes, so the call is definitely working, I just can't seem to update the checked property.

  • task.Checkmark returns either 0 or 1 as an integer, which results in the following error: "Cannot convert a primitive value to the expected type 'Edm.String'. See the inner exception for more details." Adding .toString() silences any errors but doesn't update the item. Using a true/false bool also returns the same error. – Ben Short May 15 '15 at 15:12
  • It doesn't error but doesn't update the field either. I'm starting to think it might be read-only. – Ben Short May 15 '15 at 15:15
  • Checkmark is not acustom field? – wjervis May 15 '15 at 15:16
  • There aren't any custom fields on the lists, if I do a GET request on Lists(<guid>)/items then all the items return a Checkmark field. This seems to change based on whether the item is checked in SharePoint or not, I can't seem to change it programatically though. – Ben Short May 15 '15 at 15:18
  • Ah! PercentComplete seems to do the trick. Thanks ever so much. – Ben Short May 15 '15 at 15:38
2

Checkmark is a read-only field. Try changing PercentComplete to 100

enter image description here

  • I've set PercentComplete to 100 and that automatically changes Checkmark to "1" and the status to completed, so this works perfectly, thanks! – Ben Short May 15 '15 at 15:43

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.