We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
milankj
12 months agoExplorer | Level 3
Dropbox file or folder owner information
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?
- ЗдравкоLegendary | Level 20
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.
- milankjExplorer | Level 3
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_foldersto 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.
- ЗдравкоLegendary | Level 20
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.
- Greg-DBDropbox Staff
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.
- ЗдравкоLegendary | Level 20
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).
About Discuss Dropbox Developer & API
795 PostsLatest Activity: 3 days ago
If 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!