0

Is it possible to add/update Document Library fields like Content Type, Version, File Size,..?

These fields are visible in view mode.

0

ContentType and File Size is a Calclated field. So we can't change that. And the Version is a Number Field Type and this is ReadOnly.

We can change the Content Type by updating ContentTypeId field with the ContentType ID in that list. To update Version field, we have to set the readonly property to false and then update the verion nuber (not recommended). We can't update the File Size field, because it automatically update the value to the field, whenever the document is added or modified.

0

You can add fields like this:

$.ajax({
url: "http://<site url>/_api/web/lists(guid'da58632f-faf0-4a78-8219-99c307747741')
  /fields",
type: "POST",
data: "{ '__metadata': { 'type': 'SP.Field' }, 'Title': 'Comments', 'FieldTypeKind': 3}",
headers: { 
"X-RequestDigest": <form digest value>,
"accept": "application/json; odata=verbose",
"content-type": "application/json;odata=verbose",
"content-length": <length of body data>
},
success: successHandler,
error: errorHandler
});

Source http://msdn.microsoft.com/en-us/library/office/dn600182(v=office.15).aspx#bk_Field

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.