cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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:Ā 

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
Go to solution

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

Š—Š“рŠ°Š²ŠŗŠ¾
Legendary | Level 20
Go to solution

Hi @trithanhnguyen,

Did you forget the path root we did talk about some time ago? šŸ˜‰

View solution in original post

2 Replies 2

Š—Š“рŠ°Š²ŠŗŠ¾
Legendary | Level 20
Go to solution

Hi @trithanhnguyen,

Did you forget the path root we did talk about some time ago? šŸ˜‰

trithanhnguyen
Helpful | Level 6
Go to solution

I tried from the root namespace and it worked. 

 

Thank you.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    trithanhnguyen Helpful | Level 6
  • User avatar
    Š—Š“рŠ°Š²ŠŗŠ¾ Legendary | Level 20
What do Dropbox user levels mean?