Forum Discussion

Ed F.14's avatar
Ed F.14
New member | Level 2
6 years ago
Solved

adding team functionality to an existing dropbox app

Hello,  I have an app in the app store,  backpack studio,   that allows access to reading and writing audio  files through dropbox....   I have a user that would like me  to support dropbox "teams" so that they can have the same functionality they have on dropbox.com -  manage their teams individiual (purple) folders and team files  inside the app. 

I'm using the objective-c API and  am able to get this far:

 [DBClientsManager authorizedTeamClient];

 DBTEAMTeamAuthRoutes *routes = teamclient.teamRoutes;

[[routes teamFolderList] setResponseBlock...

I get back: This API function requires a Dropbox Business API app key, but the OAuth 2 access token you provided was created with a Dropbox API app key.  To create a a Dropbox Business API app key, see...

Does that mean that i'm unable to add this functionality  without a creating a separate app designed specifically for business teams?   Or am i simply making the wrong api call to get the folder data?       

    DBTEAMTeamAuthRoutes *routes = teamclient.teamRoutes;

    DBTransportDefaultClient *transportclient = routes.client;

       [[routes teamFolderList] setResponseBlock:^(DBTEAMTeamFolderListResult * _Nullable result, DBTEAMTeamFolderListError * _Nullable routeError, DBRequestError * _Nullable networkError) {

  • Yes, that's right. That would use the user's folder, if they're not on a team with a team space, or the team space folder, if they are on a team with the team space. Also, note you can use initWithRoot if you do intend to access the root and want verification mentioned under the "Root" part of the "Dropbox-API-Path-Root Header Modes" section of the Namespace Guide (whereas initWithNamespaceId can be used for any particular namespace the user has access to).

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    If you just want to be able to access files and folders in their "team space", you don't need to register a "Dropbox Business API" app or use the "teamRoutes". (That's for accessing functionality specific to managing Dropbox Business teams, e.g., adding or removing members.)

    You can use your existing "Dropbox API" app with the "full Dropbox" permission to access files in their "team space" (that is, outside their individual purple member folder). API calls default to the member folder though, so you'll need to update your code to specify the team space if/when desired to access it. You can find more information on how this works in the Namespace Guide. That covers how to use the 'Dropbox-API-Path-Root' header to specify the team space.

    In the official Dropbox API v2 Objective-C SDK in particular, you can set the 'Dropbox-API-Path-Root' header using the DBUserClient.withPathRoot method.

    • Ed F.14's avatar
      Ed F.14
      New member | Level 2

      Thank you -  so just to clarify from reading  the namespace guide -  would an objective c implementation that simultaniously supports users on teams and regular users  not on teams work like this: 

       [[client.usersRoutes getCurrentAccount] setResponseBlock:^(DBUSERSFullAccount * _Nullable result, DBNilObject * _Nullable routeError, DBRequestError * _Nullable networkError) {
             //get the root namespace id ... will be the home folder if not on a team 
              NSString *namespaceId = result.rootInfo.rootNamespaceId;
             //create a dbcommonpathroot  with the namespace id 
              DBCOMMONPathRoot *cpr = [[DBCOMMONPathRoot alloc] initWithNamespaceId:namespaceId];
             // make a new client by calling client with the root object 
              client = [client withPathRoot:cpr];
             //
             // call to get folders etc...

       

      Or is there  a simpler way i am overlooking? 

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Yes, that's right. That would use the user's folder, if they're not on a team with a team space, or the team space folder, if they are on a team with the team space. Also, note you can use initWithRoot if you do intend to access the root and want verification mentioned under the "Root" part of the "Dropbox-API-Path-Root Header Modes" section of the Namespace Guide (whereas initWithNamespaceId can be used for any particular namespace the user has access to).