.NET SDK - upload file with versioning
AnsweredUsing the Box .NET SDK.
Am I doing this correctly? I want to upload a file and if it already exists in the account, upload a new version. I'm doing a "preflight check" to see if the file already exists. If it doesn't, I can just upload the file. If it does exist, then I get the BoxFile.Id of the existing file and use that in my BoxFileRequest. My assumption is including the file Id, Box will assume I want a new version.
BoxFileRequest request = new BoxFileRequest() { Name = fileName, Parent = new BoxRequestEntity() { Id = boxFolderId }, Id = fileId }; result = await this._boxClient.FilesManager.UploadAsync(request, stream);
However -- I'm still getting a "file name in use" exception. Am I doing something wrong or is the problem I'm using a free Developer account and maybe versioning is not allowed. Also, I'm uploading the exact file again with no changes.
If you need more info, please let me know. Thanks!
-
Upload File and Upload File Version are implemented as different methods in the .NET SDK. Here's the method in the .NET SDK to upload a new file version. There shouldn't be any restrictions for a developer account to use the file version endpoint.
Please sign in to leave a comment.
Comments
2 comments