使用 Dropbox 共享文件夹时出现模式不匹配错误 API

Getting pattern mismatch error while sharing a folder using Dropbox API

我正在开发一个使用 Dropbox Core SDK v3.0.3 的 Android 应用程序。 在尝试与其他成员共享文件夹时,我不断收到错误消息。该代码以指定的名称创建一个新的共享文件夹,但不添加任何成员。

这是我的代码:

List<AddMember> list = new ArrayList<AddMember>();
AddMember newMember = new AddMember(MemberSelector.email(clerkDbId), AccessLevel.EDITOR);
list.add(newMember);
ShareFolderLaunch sfl = dbxClient.sharing().shareFolder("/" + clerkName);
dbxClient.sharing().addFolderMember(sfl.getCompleteValue().toString(), list); //I am getting error here.

clerkName:共享文件夹名称

clerkDbId: 我要共享上述文件夹的 Dropbox id

我尝试将第一行更改为:

ArrayList<AddMember> list = new ArrayList<>();

我仍然遇到同样的错误。这是我得到的错误:

String 'sharedFolderId' does not match pattern java.lang.IllegalArgumentException: String 'sharedFolderId' does not match pattern at com.dropbox.core.v2.sharing.AddFolderMemberArg.(AddFolderMemberArg.java:50) at com.dropbox.core.v2.sharing.AddFolderMemberArg.(AddFolderMemberArg.java:86) at com.dropbox.core.v2.sharing.DbxUserSharingRequests.addFolderMember(DbxUserSharingRequests.java:154) at com.dbapp.ashworth.adminapp.FilesActivity.doInBackground(FilesActivity.java:126) at com.dbapp.ashworth.adminapp.FilesActivity.doInBackground(FilesActivity.java:115) at android.os.AsyncTask.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

谁能告诉我我做错了什么?

错误消息表明您传递给 addFolderMembersharedFolderId 参数值似乎不是有效的共享文件夹 ID。

您正在传递整个 SharedFolderMetadata(作为字符串)。您应该像这样获取共享文件夹 ID:

sfl.getCompleteValue().getSharedFolderId();

顺便说一句,当调用shareFolder, you're not guaranteed to get the completed information immediately. You should use ShareFolderLaunch.isComplete/ShareFolderLaunch.isAsyncJobId to check what you got back. There's more information in the shareFolder documentation