cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Musicians, convert your MuseScore files to PDF to play music on the go! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: team member name of a file

team member name of a file

jasmine_r
Helpful | Level 6
Go to solution

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 Is there any api in java to find the team member name?

1 Accepted Solution

Accepted Solutions

jasmine_r
Helpful | Level 6
Go to solution

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();

 

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

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
Helpful | Level 6
Go to solution

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_r
Helpful | Level 6
Go to solution

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();

 

Need more support?