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.

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: create a folder that will be shared and add a member to it

create a folder that will be shared and add a member to it

thanasis k.
New member | Level 1

iam using the code below in a java desktop application, in order to create a folder in a dropbox account that i want to be shared, and i am trying to add another member by his email address, but iam getting:

java.lang.NoSuchMethodError: com.dropbox.core.json.JsonWriter.writeFields(Ljava/lang/Object;Lcom/fasterxml/jackson/core/JsonGenerator;)V
at com.dropbox.core.v2.DbxFiles$CreateFolderArg$1.write(DbxFiles.java:5337)
at com.dropbox.core.v2.DbxFiles$CreateFolderArg$1.write(DbxFiles.java:5332)
at com.dropbox.core.json.JsonWriter.writeToStream(JsonWriter.java:23)
at com.dropbox.core.json.JsonWriter.writeToStream(JsonWriter.java:33)
at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:82)
at com.dropbox.core.v2.DbxFiles.createFolder(DbxFiles.java:8459)
at com.dropbox.core.v2.DbxFiles.createFolder(DbxFiles.java:8479) 

 

my code is the following:

DbxRequestConfig dbxRequestConfig = new DbxRequestConfig("test/1.0", Locale.getDefault().toString());
DbxClientV2 dbxClient = new DbxClientV2(dbxRequestConfig, my_access_token);

FolderMetadata md = dbxClient.files.createFolder("/test");

ArrayList<AddMember> list = new ArrayList();
DbxSharing.AddMember a1 = new DbxSharing.AddMember(DbxSharing.MemberSelector.email("xxxxxx@gmail.com"),DbxSharing.AccessLevel.editor);

list.add(a1);
dbxClient.sharing.addFolderMember(md.parentSharedFolderId, list);

 

i have already search for any solution to create a shared folder and add a member to it, but iam not finding anything useful to my case.

Could anyone tell me what iam doing wrong??please help me ASAP.

14 Replies 14

thanasis k.
New member | Level 1

i gave the final solution to my problem. My working code is:

ArrayList<DbxSharing.AddMember> list = new ArrayList<DbxSharing.AddMember>();
DbxSharing.AddMember a1 = new DbxSharing.AddMember(DbxSharing.MemberSelector.email("xxxxx@gmail.com"), DbxSharing.AccessLevel.editor);

list.add(a1);
ShareFolderLaunch l = dbxClient.sharing.shareFolder("/test");
SharedFolderMetadata md2 = l.getComplete();

dbxClient.sharing.addFolderMember(md2.sharedFolderId,list);

Suryakant D.
New member | Level 1

What if I want to add a member to already shared folder??

 

Greg-DB
Dropbox Staff

Suryakant, you can use the addFolderMember method to add members to already shared folders.

Suryakant D.
New member | Level 1

@Gregory. Thanks for your reply. Actually I have shared the folder. Added a member to it. Now I want to get and accept the invitation request programtically

Greg-DB
Dropbox Staff

You can use the mountFolder method to mount the shared folder in the invited user's account, as long as that user has authorized the app on their account as well.

Need more support?