2

Is there an api to upload a file along with Version Comments?

When I upload a file through the SharePoint portal, the file upload popup also provides a text box to include version comments if needed. I am expecting the File upload REST API to have an equivalent parameter but I am not finding it. Currently what we do to upload - Do a HTTP post with the file content to the below API

_api/web/getfolderbyserverrelativeurl('{0}')/files/add(overwrite=true,url='{1}')

Is there a way to post Version comments too?

1

You can use /checkin(comment='Check-in comment.',checkintype=0) OR /publish(comment='Check-in comment for the publish operation.') OR approve(comment='Check-in comment for the approval.')

For example:

_api/web/getfolderbyserverrelativeurl('{0}')/files/add(overwrite=true,url='{1}')/publish(comment='Check-in comment for the publish operation.')

More information: https://msdn.microsoft.com/EN-US/library/office/dn450841.aspx

  • Check in, publish and approve are meant for different purposes. My requirement is to upload a file with version comments. I want to know if i can pass the version comments as a parameter while calling the add method to upload the file!! – jkr Jul 28 '15 at 8:18

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.