I am trying to set the property ReadOnlyField to false on a column using the REST API. I am trying to do this using Postman in chrome and not able to get this to work.
The Microsoft API lists how to do this using ajax:
$.ajax({
url: "http://<site url>/_api/web/lists(guid'da58632f-faf0-4a78-8219-99c307747741')
/fields('1d22ea11-1e32-424e-89ab-9fedbadb6ce1')
/setshowindisplayform(false)",
type: "POST",
headers: { "X-RequestDigest": <form digest value> },
success: successHandler,
error: errorHandler
});
so at first I tried retrieving the value of the field using the following url and that worked (fake SP name):
GET https://example.companyname.com/EmpPic/_api/web/lists(guid'XXX-XXX')/Fields(guid'XXX-XXX')
Headers: Accept: application/json;odata=verbose
RESULT:
{
"d": {
"ReadOnlyField": true
}
}
The next step was to get the FormDigest for the POST. Here is what that looks like:
POST https://example.companyname.com/EmpPic/_api/contextinfo
Headers: Accept: application/json;odata=verbose
I got back the FormDigest and now performed the POST to set the field property:
POST https://example.companyname.com/EmpPic/_api/web/lists(guid'XXX-XXX')/Fields(guid'XXX-XXX')/ReadOnlyField(false)
Headers: X-RequestDigest: 0xE80E234234....
Accept: application/json; odata=verbose
RESULT:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
"message": {
"lang": "en-US",
"value": "Cannot find resource for the request ReadOnlyField."
}
}
}
Anyone know why I am getting the error "Cannot find resource for the request ReadOnlyField"?
I've tried this: .../Fields(guid'XXX-XXX')/ReadOnlyField(False)
and the error I got was:
"The expression \"web/lists(guid'XXX-XXX')/Fields(guid'XXX-XXX')/ReadOnlyField(False)\" is not valid.