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

trithanhnguyen's avatar
trithanhnguyen
Helpful | Level 6
3 years ago

How can I get the file metadata from the file ID of a shared file in the team Namespace.

I am writing an application that monitor the file events for the team; we have a team namespace and I am  using the Refresh Team Token for the API in Java. The information I get from the event in the Event Log for a file event is not enough for my use. It does not have the File Hash Content, file size most of the time is null, and other information which the FileMetaData has. So from the DbxTeamClient, I switch to the Team Member and then I tried to get the DbxUserFilesRequests so I can get the MetaData. It works for the private files, but it fails if the file is shared. I tried all the member ID and it always fails it the file is shared. Can anybody know how to get the Metadata for a shared file. I will show the code where the API call is failed.

 

static Metadata getFileMetaDataFromFilePath(String teamMemberId, String path) throws DbxException {
DbxClientV2 dbxClient = dbxTeamClient.asMember(teamMemberId);
DbxUserFilesRequests dbxUserFilesRequests = dbxClient.files();
Metadata metadata = dbxUserFilesRequests.getMetadata(path);//It fails right here if the file is shared file.

System.out.println(metadata.toStringMultiline());
return metadata;
}

These are the error messages :

 

Exception in thread "main" com.dropbox.core.v2.files.GetMetadataErrorException: Exception in 2/files/get_metadata: {".tag":"path","path":"not_found"}
at com.dropbox.core.v2.files.DbxUserFilesRequests.getMetadata(DbxUserFilesRequests.java:1563)
at com.dropbox.core.v2.files.DbxUserFilesRequests.getMetadata(DbxUserFilesRequests.java:1586)
at tri.test.features.file.info.FileMetaData.getFileMetaDataFromFilePath(FileMetaData.java:437)
at tri.test.features.file.info.FileMetaData.main(FileMetaData.java:468)

 

About View, download, and export

Need support with viewing, downloading, and exporting files and folders from your Dropbox account? Find help from the Dropbox Community.

Need more support

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!