I'm using the GetFileByServerRelativeUrl [1] api to update the content of a file. I don't want to create unnecessary new versions for a file. Office365 Word does not create extra versions on save without checkout.

Explanation: I'm building an app which can edit files stored on sharepoint.

  • User 1 opens and edits file X (He/She chooses to not checkout the document).
  • User 1 saves file X. (Version 12 is created)
  • User 1 continues editing.
  • User 1 saves file X. (Version 13 is created)

Since the user did not exit my app, the version should not be increased on save. The version should only increase if a User 2 edits the file while User 1 was editing.

I cannot find a way to do what Office365 does on save. To save over the last version of the file if the user did not exit my app. I'm guessing the api should allow for an additional param, like version, over which to save.. Or sessionId, to let sharepoint know my app editing session was not closed.

I already asked this question here [2]. It looks like this is not possible with the REST api. Is there another way to do this? Maybe delete the old version of a file and "rename the version" of the latest version?

[1] https://msdn.microsoft.com/en-us/library/office/dn450841.aspx#code-snippet-3

[2] https://social.msdn.microsoft.com/Forums/office/en-US/d872af24-427e-4699-9c64-5beaa0d12211/sharepoint-rest-api-update-file-contents-without-creating-new-version?forum=appsforsharepoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.