Overwrite a file on Box with out creating a new version
Hello,
I am trying to download a file, make some changes to the file and upload the file using .net sdk console app. I tried to upload the same file using the API UploadAsync but it gave an exception that file already exist. So I used the the API UploadNewVersionAsync to overwrite the file, but as the name suggest it creates a version. My requirement is to overwrite the file without creating a new version. Please let me know if that is possible.
Thanks,
Subhash
-
Hi - There is no concept of a non-versioned file replacement in Box. All files in Box are assigned a unique file id, and when you replace them, the file id stays the same, but a new version id is created.
If you wish to 'replace' a file without preserving the history, I think you have two options:
1. Delete the file and upload a new one (note that the file id will change)
2. Upload the new file and remove past versions - https://developer.box.com/reference/delete-files-id-versions-id/
I am not sure if either of these satisfies your use case. Can you please elaborate why you wish to replace a file without preserving versions?
Please sign in to leave a comment.
Comments
4 comments