Forum Discussion

sin5's avatar
sin5
Explorer | Level 3
5 years ago
Solved

I want to get a list of files in a shared folder using Objective-C SDK

I'm using Objective-c SDK v2.


I used the initWithAccessToken method of the DBTeamClient class to get an instance of the DBUserClient class.

I used the listFolders method of sharingRoutes of DBUserClient to get the shared folders that exist in the root.

 

But, I don't know how to get the list of files that exist in the obtained shade folder.

It seems that the shade folder cannot be accessed by filesRoutes of DBUserClient.

 

What steps do I need to take to get a list of the files that exist in the shared folder?

 

  • If pathLower is nil, that means that the folder is not "mounted", so it doesn't have a path in that account. I recommend reading the File Access Guide and the Team Files Guide for more information on how these mechanisms work. 

     

    For reference, if you need to set the "Dropbox-API-Path-Root" header mentioned there, that's accessible via withPathRoot in the Objective-C SDK.

    • sin5's avatar
      sin5
      Explorer | Level 3

      Thank you Greg-DB.

       

      I ran the following source to get DBSHARINGSharedFolderMetadataBase.

      The folder shared in the personal folder was able to get the pathLower.

      But, the DropBox Business team folder had a pathLower of nil.

       

      Is the procedure different for the DropBox Business team folder?

       

      DBUserClient *userClient = [teamClient userClientWithMemberId:_MY_MEMBER_ID_];
      
      [[userClient.sharingRoutes listFolders] setResponseBlock:^(DBSHARINGListFoldersResult * _Nullable result, DBNilObject * _Nullable routeError, DBRequestError * _Nullable networkError) { for (DBSHARINGSharedFolderMetadata *entry in result.entries) { if(entry.pathLower==nil){ NSLog(@"pathLower is nil"); }else{ NSLog(entry.pathLower); } } }];
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        If pathLower is nil, that means that the folder is not "mounted", so it doesn't have a path in that account. I recommend reading the File Access Guide and the Team Files Guide for more information on how these mechanisms work. 

         

        For reference, if you need to set the "Dropbox-API-Path-Root" header mentioned there, that's accessible via withPathRoot in the Objective-C SDK.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 16 hours ago
351 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!