cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: How to specify folder path in the team level folders.

How to specify folder path in the team level folders.

santhoshkelathodi
New member | Level 2

I want to use the Dropbox API to access the Dropbox for managing my data storage. I am successfully able to connect to dropbox by adding an app by setting appropiate permissions to the app and by generating access token. However, I would like to Access the folders that are outside my personal folder.

Team DigitalAqua

    |-Santhosh Kumaran

    |    -test

    |        -text1.txt

    |    -Santhosh Kumaran - Shortcut.lnk

    |    -santhosh.kumaran@xxxx.xx’s files

    |-Videos

    |   - A

    |   - B

    |   - B

My intented work:

Step 1: Connect to the Dropbox: ->Success

 

import dropbox
# Token Generated from dropbox
TOKEN = "<Generated_TOKEN>"
dbx = dropbox.Dropbox(TOKEN)
print('Connected to Dropbox successfully')

Step 2: Specify the folder: Works for my folder Santhosh Kumaran

folder_path = "/test" ## Works
folder_path = "../Videos" Does not work

Step 3: List the files in the folder

        files = dbx.files_list_folder(folder_path).entries
        print("------------Listing Files in Folder------------ ")
        for file in files:
            # listing
            print(file.name)

 

Step 4: Make all the files and folders at the folder path to online-only to avoid the local storage to be overused. I would like less storage on local disk.

I do not know how to do it

5 Replies 5

Здравко
Legendary | Level 20

Hi @santhoshkelathodi,

When you didn't specify something else, the default behavior is your member folder to be used as a root (as you find it out already). Team accounts are organized in namespaces (take a look here for more info) and you can select what to be your root in Dropbox Python SDK using with_path_root method.

Hope this gives direction about your main concern.

 


@santhoshkelathodi wrote:
...
# Token Generated from dropbox
TOKEN = "<Generated_TOKEN>"
dbx = dropbox.Dropbox(TOKEN)

...


Hm..🤔 Are you aware that access token is short lived and you will need to regenerate it regularly? To avoid doing it by hand, you can use refresh token. Handy example how you can use it can be seen here. A complete example application may be of your interest too.

 


@santhoshkelathodi wrote:

...

Step 4: Make all the files and folders at the folder path to online-only to avoid the local storage to be optimized.

I do not know how to do it


You cannot do that, since it's per application setting and you need direct communication to every particular application, where you need to set file status, not to Dropbox server. At present, Dropbox API may communicate to Dropbox servers only, not to installed applications directly.

santhoshkelathodi
New member | Level 2

Thank you for the answers. I will go through the examples and the solutions provided to check if I can access the other folders. Regarding the question on whether I can set the local folders to online-only mode ( By the way, this is possible by right clicking on the respective folder), is your answer that it is not possible programmatically using dropbox APIs?

Здравко
Legendary | Level 20

@santhoshkelathodi wrote:

... ( By the way, this is possible by right clicking on the respective folder), ...


Exactly, in such a case you're accessing no the cloud folder, but local application folder! 🙂 Hope you can make difference.

 


@santhoshkelathodi wrote:

..., is your answer that it is not possible programmatically using dropbox APIs?


As I said, API accesses only the cloud. So, Yes. Let's hope this will be changed, but better don't rely on.

DB-Des
Dropbox Engineer

I have submitted a feature request for files and folders to be available offline and online-only using the API.

 

I am unable to provide a timeline of if and when this feature will be implemented, however.

Здравко
Legendary | Level 20

@DB-Des wrote:

...

I am unable to provide a timeline of if and when this feature will be implemented, however.


Hi @DB-Des,

"Will be implemented"??? 🤔 What actually has to be implemented? Everything is implemented already! 🙂 The only missing thing is the documentation. How fast staff responsible for technical documentation can work? 😀 It's matter of wish, nothing else. The communication, as a option, is available through the local sockets open by the installed Dropbox application and is not from yesterday. Can you point out to some description? That's the missing thing. Implementation in SDKs would helpful too (together with corresponding documentation of course).

Need more support?