You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
mau21mau
4 years agoExplorer | Level 3
Upload content to shared file
We currently use Dropbox's Python SDK to overwrite existing file contents with the method .files_upload(). With give it the file id as a parameter along with the file content and it works:
client.files_upload(
file_contents,
file_id,
mode=WriteMode.overwrite
)
The problem is that, if the file is a shared one, it won't work. Is it even possible?
- Greg-DBDropbox Staff
Can you clarify what you mean when you say "it won't work"? What error/output do you get?
You should be able to use this method to upload to an existing file by specifying the file ID, even if it's in a shared folder, for instance, as long as the file is in the connected account and the account has write access.
- mau21mauExplorer | Level 3
But what if the file is stored at root? Or what if someone shared only the file and not its parent folder necessarily? I have simulated two cases. One which the file is shared with me, but it's stored at the owner's root folder. The other file is stored at a folder which I don't have access to the folder, only the file. In both cases I get the following error:
dropbox.exceptions.ApiError: ApiError('dc54baf177204ec09c535d47a46e21b2', UploadError('path', UploadWriteFailed(reason=WriteError('no_write_permission', None), upload_session_id='AAAAAAAAAkihHB-Mp2VFBg')))
- Greg-DBDropbox Staff
The location within the account doesn't really matter, but which account it is in does matter. From your description, it sounds like the file is not in the connected account (that is, the account for the access token you're using), but rather is in another account (and the file just happens to be shared individually to the connected account).
Since the file is not actually in the connected account, the connected account does not have the ability to write to it, resulting in this 'no_write_permission' error.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!