cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

Real Example of ListFolderContinue: method in Objective-C

Real Example of ListFolderContinue: method in Objective-C

ponkymar
Explorer | Level 3

Can someone please provide me a real example to show how listfoldercontinue: method works with listfolder: in objective-c or in swift? I have read 100 times the description of listfoldercontinue: method but can't understand in the right way. my folder always remains empty.

 

Previously I was using servermodified to know when the contents of a folder metdata changed.

 

To Dropbox team: Is it possible to get clientmodified and servermodified properties for DBFILESFolderMeta as well too just like we have clientModified and serverModified properties are available only for DBFILESFileMetadata?

 

Thank You

Ponky 

1 Accepted Solution

Accepted Solutions

Re: Real Example of ListFolderContinue: method in Objective-C

Greg-DB
Dropboxer
The team just added a new sample to the README that shows how to use listFolder and listFolderContinue together:

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

Hope this helps!

View solution in original post

7 Replies 7

Re: Real Example of ListFolderContinue: method in Objective-C

Mark
Super User II

*moves to API forum*


 


:penguin::penguin: - :penguin: - :penguin: - :penguin:


Heart Did this post help you? If so please mark it for some Kudos below. 


:white_check_mark: Did this post fix your issue/answer your question? If so please press the 'Accept as Solution' button to help others find it.


:arrows_counterclockwise: Did this post not resolve your issue? If so please give us some more information so we can try and help - please remember we cannot see over your shoulder so be as descriptive as possible! 


 

Re: Real Example of ListFolderContinue: method in Objective-C

Greg-DB
Dropboxer
Thanks for the post! I don't believe we have a sample exactly like that available, so I'll send this along as a request for one.

I'm also sending this along as a request for modified times on non-file metadata, but I can't make any promises as to if or when that would be implemented and released. Using listFolder/listFolderContinue is a better way to keep track of changes.

Re: Real Example of ListFolderContinue: method in Objective-C

Greg-DB
Dropboxer
The team just added a new sample to the README that shows how to use listFolder and listFolderContinue together:

https://github.com/dropbox/dropbox-sdk-obj-c#rpc-style-request

Hope this helps!

View solution in original post

you

ponkymar
Explorer | Level 3

To Dropbox Team, 

Thank You for providing real example of listfolderContinue: method. Also now no need of timestamp property (like servermodified) for non-file type. 

 

Thank You again, 

Re: Real Example of ListFolderContinue: method in Objective-C

brduffy
Explorer | Level 4

Here is some example Swift code based on the Objective C code. This works for me to get all of the folders and directories including shared folders and directories.


func listFolderContinueWithClient(client: DropboxClient, cursor: String) { client.files.listFolderContinue(cursor: cursor).response { response, error in if let result = response { print("entries in continue:") for entry in result.entries { //if entry.name.hasSuffix(".fm") { if let folder = entry as? Files.FolderMetadata { print("directory") print(entry.pathDisplay!) self.dropBoxDirectoryArray.append(URL(fileURLWithPath: entry.pathLower!)) }else{ //print(entry.name) print(entry.pathDisplay!) self.dropBoxFileArray.append(URL(fileURLWithPath: entry.pathLower!)) } } if result.hasMore == true { self.listFolderContinueWithClient(client: client, cursor: cursor) }else{ print("no more entries") } } else { print("Error: \(error!)") } } } // FIXME: - root controler button click @objc func onClickBarButton(sender: UIBarButtonItem) { if sender.tag == 40 { // get from dropBox print("This is Directory Array") dump(self.dropBoxDirectoryArray) print("This is File array") dump(self.dropBoxFileArray) if let client = DropboxClientsManager.authorizedClient { client.files.listFolder(path: "", recursive: true).response { response, error in if let result = response { print("Folder contents:") for entry in result.entries { //if entry.name.hasSuffix(".fm") { if let folder = entry as? Files.FolderMetadata { print("directory") print(entry.pathLower!) // check for unmounted folders with a null pathLower self.dropBoxDirectoryArray.append(URL(fileURLWithPath: entry.pathLower!)) }else{ //print(entry.name) print(entry.pathDisplay!) self.dropBoxFileArray.append(URL(fileURLWithPath: entry.pathLower!)) } } if result.hasMore == true { self.listFolderContinueWithClient(client: client, cursor: result.cursor) }else{ } } else { print("Error: \(error!)") } } }else{ var topController = UIApplication.shared.keyWindow?.rootViewController while let presentedViewController = topController!.presentedViewController { topController = presentedViewController } DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: topController, openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) }) } }

Re: Real Example of ListFolderContinue: method in Objective-C

siddharth chauhan
New member | Level 2

in recursive call shouldn't it be

self.listFolderContinueWithClient(client: client, cursor: result.cursor)

instead of this

self.listFolderContinueWithClient(client: client, cursor: cursor)

Re: Real Example of ListFolderContinue: method in Objective-C

Greg-DB
Dropboxer

@siddharth chauhan Yes, you're correct. The app should use the latest returned cursor, which would be result.cursor there.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    siddharth chauhan New member | Level 2
  • User avatar
    brduffy Explorer | Level 4
  • User avatar
    ponkymar Explorer | Level 3
What do Dropbox user levels mean?
Need more support?