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
jasmine_r
7 years agoHelpful | Level 6
team member name of a file
Hi, i have a shared folder with 3 users, How do i obtain the name of the user who uploads a file in the shared folder. Does the file inside the shared folder contains any attribute about the user or...
- 7 years ago
Hi, i have fixed it, i tried it with Metadata instead of FileMetadata and that was the problem. This worked without any errors.
FileMetadata filemetadata = (FileMetadata)client.files().getMetadata(metadata.getPathLower()); FileSharingInfo fileSharingInfo = filemetadata.getSharingInfo(); fileSharingInfo.getModifiedBy();
Greg-DB
Dropbox Staff
Yes, when you get the FileMetadata for a file, e.g., in the response from DbxUserFilesRequests.listFolder/listFolderContinue, you can use FileMetadata.getSharingInfo to get the FileSharingInfo. On that, you can use FileSharingInfo.getModifiedBy to get the account ID of the user that modified it. You can then use getAccount to get more information about that user if necessary.
jasmine_r
7 years agoHelpful | Level 6
Hi, I m able to get the shared folders and files with listFolderBuilder and listFolderContinue. This is my code
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US"); DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
ListFolderResultresult=client.files().listFolderBuilder("").withIncludeDeleted(true).withRecursive(true).start(); while (true) { for (Metadata metadata : result.getEntries()) { System.out.println(metadata.getPathLower()+"\t"+metadata.getName()); } if (!result.getHasMore()) { break; } result = client.files().listFolderContinue(result.getCursor()); }
this returns a json data from where i can retrieve id, name, path etc.
{ "entries": [ { ".tag":"file", "name":"Sample.java", "id":"id:nDRxdFgbLhAAAAAAAAAAJA", "client_modified":"2018-06-21T11:15:59Z", "server_modified":"2018-06-21T11:16:00Z", "rev":"2c9463620", "size":1837, "path_lower":"/abc/sample.java", "path_display":"/abc/Sample.java", "parent_shared_folder_id":"3376821792", "sharing_info":{"read_only":false, "parent_shared_folder_id":"3376821792", "modified_by":"dbid:AADz0pcde3etsRJmumakFzDDH-aJzp2vYRo" } } ], "cursor":"AAHDAg8um0mKlykS0oaq2UAczjkJCm3hPYZa_8HyYwaWAZLZc_5cMJtPPLuHvltxUrdepeLalz5LxncSUPfVq915nU4fEqCIFqncL_Hxvw8cnOVL0dfQ_bTvP5f9Qhbk-Hp7qhIB8pAmZsxli60ZTFwmqLET8zUbGKbSIdSCrJ1wgfyns6NquC-TzeT4wELWDD0", "has_more":false }
I'm stuck how to get the sharing_info, i tried using
FileSharingInfo data = metadata.getSharingInfo(); data.getModifiedBy();
But it doesn't work. What am i missing here ?
- jasmine_r7 years agoHelpful | Level 6
Hi, i have fixed it, i tried it with Metadata instead of FileMetadata and that was the problem. This worked without any errors.
FileMetadata filemetadata = (FileMetadata)client.files().getMetadata(metadata.getPathLower()); FileSharingInfo fileSharingInfo = filemetadata.getSharingInfo(); fileSharingInfo.getModifiedBy();
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 months 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!