cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Accessing .tag or just listing folders Swift

Accessing .tag or just listing folders Swift

StevenWhitey
New member | Level 2
Go to solution

I have looked everywhere and can't seem to find an answer. I am trying to list just folders in a table. When I do a listFolder call it gives me all the folders and files with a .tag. Is there any way to access that .tag or just list the folders? I know you can list files by using the Suffix but what about folders? Thanks for your help. Below is what I get back with my listFolder call.

 

cursor = "AAHIpnuEeMPvYAsZGaogNyLu0QCvyr6T5YnIK_2ZQDfObTzFEIaf4BKSdaJsgIxC82IirZgWfzvN41axn-jKmySsPHoXwGmn-mxsEKHgV_hOUHqIUQxURYlL2AzzbzcZNZvo3AKmlPDRGkLq3Ax6uvMmSN1ZdKg3QHoGIIeno_9Jn-DbrzZG3Qx8un1ekCASy00";

    entries =     (

                {

            ".tag" = folder;

            id = "id:EinVKuuPCRAAAAAAAAAAAw";

            name = "Test Folder";

            "path_display" = "/Test Folder";

            "path_lower" = "/test folder";

        },

                {

            ".tag" = folder;

            id = "id:EinVKuuPCRAAAAAAAAAAFw";

            name = "2nd folder";

            "path_display" = "/Test Folder/2nd folder";

            "path_lower" = "/test folder/2nd folder";

        },

                {

            ".tag" = folder;

            id = "id:EinVKuuPCRAAAAAAAAAAHA";

            name = "Another Folder";

            "path_display" = "/Another Folder";

            "path_lower" = "/another folder";

        },

                {

            ".tag" = folder;

            id = "id:EinVKuuPCRAAAAAAAAAAIA";

            name = "Photo Watch";

            "path_display" = "/Apps/Photo Watch";

            "path_lower" = "/apps/photo watch";

        },

                {

            ".tag" = folder;

            id = "id:EinVKuuPCRAAAAAAAAAAHw";

            name = Apps;

            "path_display" = "/Apps";

            "path_lower" = "/apps";

        },

                {

            ".tag" = file;

            "client_modified" = "2016-11-01T22:37:58Z";

            id = "id:EinVKuuPCRAAAAAAAAAAAg";

            name = "Get Started with Dropbox.pdf";

            "path_display" = "/Get Started with Dropbox.pdf";

            "path_lower" = "/get started with dropbox.pdf";

            rev = 1502f5529;

            "server_modified" = "2016-11-01T22:37:58Z";

            size = 905827;

        },

                {

            ".tag" = file;

            "client_modified" = "2016-11-02T03:28:56Z";

            id = "id:EinVKuuPCRAAAAAAAAAABA";

            name = "8-3-Travel-Photo-3.jpg";

            "path_display" = "/Test Folder/8-3-Travel-Photo-3.jpg";

            "path_lower" = "/test folder/8-3-travel-photo-3.jpg";

            rev = 3502f5529;

            "server_modified" = "2016-11-02T03:28:56Z";

            size = 109879;

        }

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

You can filter Metadata objects by checking if they are FileMetadata or FolderMetadata (or DeletedMetadata) instances as shown here:

 

https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases

View solution in original post

3 Replies 3

Greg-DB
Dropbox Staff
Go to solution

You can filter Metadata objects by checking if they are FileMetadata or FolderMetadata (or DeletedMetadata) instances as shown here:

 

https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases

ravisharma
New member | Level 2
Go to solution
Can you share your code?

Greg-DB
Dropbox Staff
Go to solution

@ravisharma What are you looking for exactly? If you need to see how to distinguish between files and folders, that's in the README:

 

https://github.com/dropbox/SwiftyDropbox#response-handling-edge-cases

 

If you're looking for a sample for listing items, there are some examples here:

 

https://github.com/dropbox/PhotoWatch/blob/48df3b99b47f4a883703f7a4cd9512eb2a5c0cb2/PhotoWatch/ViewC...
https://stackoverflow.com/documentation/dropbox-api/412/listing-a-folder/1371/listing-the-root-folde...

 

Those only call listFolder though, so you'll need to make sure you call listFolderContinue too, as described in the second link.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    ravisharma New member | Level 2
What do Dropbox user levels mean?