Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Sheeja's avatar
Sheeja
Explorer | Level 3
2 years ago
Solved

Can we access/upload files to a shared folder that's outside my root folder programmatically

We have a requirement , where I have access to a shared folder which is placed outside of my root foler. I need to programmatically access/upload files/create sub folders inside this shared folder . We tried creating an app from app console.We could access folders inside my root folder using the accesstoken+secret token combination generated by the App. But the shared folder is not getting recognised/ not accessible.Is there a way to achieve this?

  • Hi Sheeja,

    You cannot access something that is outside your root folder in any way either programmatically or not. Probably something confuses you. Any data should be available in your account folder tree before you be able to do anything there. Outside your root means either data stay inaccessible to you or not mounted/copied in your account.

     


    Sheeja wrote:

    ...We could access folders inside my root folder using the accesstoken+secret token combination generated by the App. ...


    Keep in mind that if your account is team account and with shared space, by default you have access only to your member folder and nothing outside! To be able get access to your root space and to all nested team folders/spaces there, you need to explicitly change your namespace - i.e. to change the default home namespace to root namespace. You can see if your home and root namespaces are different and which one is the root namespace using /2/users/get_current_account or equivalent SDK method (focus on root_info in the result). You may need to set the root with value of HTTP header Dropbox-Api-Path-Root or equivalent SDK method.

    Hope this helps.

7 Replies

Replies have been turned off for this discussion
  • Здравко's avatar
    Здравко
    Legendary | Level 20
    2 years ago

    Hi Sheeja,

    You cannot access something that is outside your root folder in any way either programmatically or not. Probably something confuses you. Any data should be available in your account folder tree before you be able to do anything there. Outside your root means either data stay inaccessible to you or not mounted/copied in your account.

     


    Sheeja wrote:

    ...We could access folders inside my root folder using the accesstoken+secret token combination generated by the App. ...


    Keep in mind that if your account is team account and with shared space, by default you have access only to your member folder and nothing outside! To be able get access to your root space and to all nested team folders/spaces there, you need to explicitly change your namespace - i.e. to change the default home namespace to root namespace. You can see if your home and root namespaces are different and which one is the root namespace using /2/users/get_current_account or equivalent SDK method (focus on root_info in the result). You may need to set the root with value of HTTP header Dropbox-Api-Path-Root or equivalent SDK method.

    Hope this helps.

  • Sheeja's avatar
    Sheeja
    Explorer | Level 3
    2 years ago

    Hi @Здравко
    Thanks for the reply. Let me give more context around the scenario. We have a customer : Gracehill who wants our team to develop a solution that creates dropbox folders/upload/download files from these folders.They have a dropbox account and they have shared the access with us.Take for example, Shameer is my login id .Im able to do all API operations within this folder. But Gracehill has shared another folder with us, which is Chargebee Sandbox and they want us to to do all operations within this folder.I have attached a screenshot for the folder structure .How can I create folders and manage permissions inside this new shared folder?
    Basically I would like to programmatically perform all API operations inside ChargeBee SandBox folder.
    As I mentioned earlier, I tried this option: to access dropbox from my code. But using this, Im just able to access root folder : Shameer and not the shared folder outside it

     



  • Sheeja's avatar
    Sheeja
    Explorer | Level 3
    2 years ago

    Hi Здравко
    Thanks for the reply. Let me give more context around the requirement. We have a customer : Gracehill. They want us to create dropbox folders and perform some API operations like upload/download files etc for each usecase. They have provided us with access to their dropbox account. Take for example : Shameer is my userId in dropbox and I'm able to do all API operations inside this folder using the OAuth mechanism mentioned here.
    Now, Gracehill has created another shared folder - ChargeBee SandBox which is visible outside my root folder: /Shameer.In this case, the Dropbox APIs doesn't seem to recognize anything outside the root folder.
    How can I point my application to do API operations in this new folder. Attaching the current folder structure here: 

     

  • Sheeja's avatar
    Sheeja
    Explorer | Level 3
    2 years ago

    Thanks for the repky Здравко. Let me give you more context around this usecase. We have a customer Gracehill. They want us to create dropbox folders and preform operations like upload/download files . They have provided us with access to their account . My login username is Shameer and I have used this method to programmatically access contents inside this root folder. But Gracehill wants us to do these API operation in another shared folder: Chargebee Sandbox. Our code only picks the data inside my root folder and not anything outside this. Could you please suggest a solution

     

     

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    2 years ago

    Sheeja, I don't know what more I can say. Did you try what I said above? As far as I can follow your questions, you haven't even give a try. 🤷 That's the way! If something confuses you, clarify your question.

    For additional info take a look here.

     

    By the way stop saying that you accessed only your root folder. The folder "Shameer R" is NOT your root folder! What you do is confusing yourself. 😁

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Sheeja Здравко is correct; by default, API calls to the Dropbox API operate in the "member folder" of the connected account, not the "team space". That means that by default, the contents of the team space will not be found.


    You can configure API calls to operate in the "team space" instead though, in order to interact with files/folders in the team space. To do so, you'll need to set the "Dropbox-API-Path-Root" header. You can find information on how to use this in the Team Files Guide.

  • Sheeja's avatar
    Sheeja
    Explorer | Level 3
    2 years ago

     

    Thanks Greg-DB and Здравко .I got it now . Sorry about the confusion earlier. My replies to the original message wasn't getting reflected earlier and hence I tried to post them again couple more times. Thanks a lot for the support
     
     
     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!