cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over here.

View, download, and export

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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
1
Ask
2
Comments

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

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

trithanhnguyen
Helpful | Level 6

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)

 

1 Accepted Solution

Accepted Solutions

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

Здравко
Super Collaborator | Level 20

Hi @trithanhnguyen,

Did you forget the path root we did talk about some time ago? 😉

View solution in original post

2 Replies 2

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

Здравко
Super Collaborator | Level 20

Hi @trithanhnguyen,

Did you forget the path root we did talk about some time ago? 😉

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

trithanhnguyen
Helpful | Level 6

I tried from the root namespace and it worked. 

 

Thank you.

Who's talking

Top contributors to this post

  • User avatar
    trithanhnguyen Helpful | Level 6
  • User avatar
    Здравко Super Collaborator | Level 20
What do Dropbox user levels mean?
Need more support?