We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
jerry14
4 years agoExplorer | Level 4
API - Getting owner information of a file that is not shared
Hi - I am trying to get owner information of a file that is not shared. I tried the below - FileMetadata fileMetadata = (FileMetadata) dbxTeamClient.asAdmin(adminId).files().getMetadata(fileId)...
Здравко
4 years agoLegendary | Level 20
Hi jerry14,
You cannot get such information within FileMetadata just because there is no such info within. 🙂 You correctly referred to SharedFileMembers (despite indirectly), where you can get desired info. Such a result you can receive from DbxUserSharingRequests.listFileMembers(java.lang.String file).
jerry14 wrote:... But the same API fails when a non-shared fileId is passed to it.
...
To be honest I have no idea what you are talking about here. 🤷 It's working as expected. What fails actually? 🤔 Can you post some code snippet able to reproduce the issue in a stable way? Describe expected output, actual output, and what exactly confuses you.
- jerry144 years agoExplorer | Level 4
Its not an issue, but I was looking for the right/best way to find users/groups that has access to a list of files.
Below are the steps:
a. The list of files (fileIds) in a Business Account (with Teamspace config) is fetched first using list_folder/list_folder_continue APIs. The authenticating user is Admin for the business account. The list includes private (non shared) files as well belonging different members in the account.
b. Now, with each of these fileIds, I was trying to fetch sharing info with the sharing/list_file_members API. I was able to get details for all files in team/shared folders with this.
c. As sharing info was not available for private files, I was looking at Metadata for "owner" information, however thats not directly available in Metadata or sharing info.
I followed what Greg-DB suggested, and below are the 3 cases depending on the file ownership/sharing status
1. For files in shared/team folders -> sharing/list_file_members API gives the information. No issues here.
2. For files that are private and belonging to members other than authenticated user -> sharing/list_file_members API gives sharing info -> and from that, modified by field gives the account Id. With the account id, I am getting account info and finding the team member id (owner)
3. For files that are private and belonging to current authenticated user (in my case, the admin user) -> unlike case (2) sharing info is NULL in the response to sharing/list_file_members. In this case, I already know the admin user's member Id. So, assigning that as the owner.
I am not sure if the approaches followed in (2) and (3) are the right/best way since it involves multiple API calls to get the owner/access information.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!