Discuss Dropbox Developer & API
while listing files from any folder (even root) i need to know the owner of the file. is there any way i can get that?
Hi @milankj,
Did you try using /2/sharing/list_file_members for whatever file you're interested in? For the file owner you'll get access_type... owner. 😉
Hope this helps.
@milankj As Здравко said, for shared files you can use /2/sharing/list_file_members[/continue] to list the members of a shared file and see which one is the owner.
If the file is not itself shared but is contained in a shared folder, you can use /2/sharing/list_folder_members[/continue] to list the members of the folder and see which one is the owner of the shared folder.
Actually list_file_members can be used for every file - including such not shared at all. In such a case will be just a single user - the owner (the account owner).
The /2/sharing/list_file_members only returns info about users, there is no information on the owner of the file.
Im trying to create a common response that would come either from google drive or dropbox conditionally. In google drive i just have to call the file.list() i get all necessary info. like the owner, permissions, thumbnail , webview link etc.
In drop box i'm collecting all these information from 4 different api : /2/sharing/list_folders
to collect shared files i'm using : /2/sharing/list_received_files
to get the thumbnail for each files i'm using: /2/files/get_thumbnail_batch
for user access info and metadata of file for preview link i'm using /2/sharing/get_file_metadata/batch
do you think is there any other way so i can reduce the number of api calls or either the response time ,cause its taking like 8 sec, to just collect 5-6 files.
@milankj wrote:while listing files from any folder (even root) i need to know the owner of the file. ...
@milankj wrote:The /2/sharing/list_file_members only returns info about users, ...
Hm...🤔 "only"??? Probably I'm missing something here. Isn't the file owner a user too? 🧐
@milankj wrote:..., there is no information on the owner of the file.
...
Strictly speaking, there are corner cases - files/folders in Dropbox doesn't need to have owner in all cases (in spite not typical and rare case). When owner leaves a shared file/folder and there are still participants, ownership doesn't transfer automatically nor Dropbox expect to be transferred (in spite possible, but should be done explicitly). So, in such a case owner will be missing. Are you in such a situation?
Another situation (more likely one) when you may not see the owner immediately is when there are many sharing participants and owner doesn't appear near front of the list. In such a case you see only the first page of the list and you have to call /2/sharing/list_file_members/continue one or more times (while there is cursor in requests response) to get the list' rest.
When you organize your application, don't do it based on particular service API/interface! It becomes likely to have difficulties if/when try re-implement in another API/interface (normally - different services organize their interfaces in different ways). If you are aware what actually you need (not what you can get to in particular service), it likely to be the same when you get to implementation steps in context of different services. There are always some possible optimization steps - using a batch version when many files need to be processed for instance instead of using single file versions. Yes, Dropbox API is far from perfect, unfortunately. There are missing many features available in Dropbox application or through the web view, but... 🤷 that's it.
Good luck.
using /2/sharing/list_folder_members my was able to get owner's info on a shared folder( a folder shared with me - not me being the owner), "shared_folder_id" value was used.
In case of a file shared to me (not in any folder just the single file) with editor access, while using /2/sharing/list_file_members the response shows only a single user, and that is me being the editor
@milankj wrote:...
In case of a file shared to me (not in any folder just the single file) with editor access, while using /2/sharing/list_file_members the response shows only a single user, and that is me being the editor
Hm..🤔 As I said it's possible in spite unlikely. Do you see the same for the same file in Dropbox web interface? Also, do you receive in the response a cursor? 🧐
For a file to which i have editor access, in web interface too it shows no info on the owner of file. Just that i have an editor access.
And no no cursor is received, (my friend shared the file with me only).
My guess is that shared folder and shared files are treated differently. The folders contain a "shared_folder_id" with helps to gather sharing information on the folder. But for files im just using the primary file id , there is no explicit shared if like the folders
@milankj wrote:...
My guess is that shared folder and shared files are treated differently. ...
No actually; they are treated in almost same way.
@milankj wrote:... The folders contain a "shared_folder_id" with helps to gather sharing information on the folder. But for files im just using the primary file id , there is no explicit shared if like the folders
Yes, that's the only difference, but nothing more. That's why more convenient way, when you're interested in files residing in arbitrary folders, is to use list_file_members instead of look in advance for containing folder - more consecutive calls needed.
@milankj wrote:...
And no no cursor is received, (my friend shared the file with me only).
...
In such a case you're the only participant of the shared file currently. Your friend seems to left sharing of discussed file (intentionally or not) and that's why the file is ownerless. Such "mistakes" (if mistakes) are likely to bring up after file editing - some editors replace the edited file on save instead of update. Better share files as part of shared folder instead of individually - in such case probability for unintentional unshare is less likely. Inform your friend about that.
Hi there!
If you need more help you can view your support options (expected response time for a 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!