问题
I have a requirement in my MVC4 App where i need to upload some files on dropbox. Please suggest me any Api which is good and have some good code samples. I have tried the API http://cgeers.com/2012/03/17/dropbox-rest-api-part-6-oauth-callback/[^]; but it is giving some error. There are many samples but they are for Asp.Net.
Please suggest the approach i can follow and some good APIs to integrate DropBox in MVC 4 App.
EDIT: The requirement is like I have a page with an option to login to Dropbox. When user clicks Login, a new tab or popup should open where user is asked to allow or deny DropBox. If user allows, it is redirected to login page. After user logins in Dropbox, the tab or popup closes or redirect back to main site. After this the uploading will be done in background.
How can i achieve the whole scenario?
I thought of opening a view in popup when user clicks on option to login to Dropbox. When user will either allow or deny, it will navigate to a callback URL of a view. this will call action method in my controller. Here i can identify if parameters appended in URL are empty/null or contain some value. If it contains some value, it means user has allowed. Also, when user clicks on option to login to Dropbox, I will initiate a timer in my controller, which will call a DropBox method every few seconds to know if the credentials are authenticated. Once it come to know that credentials are authenticated, timer will be stopped. Timer will run only for 5 minutes. at the same time, i will close popup. Also, i need to change the text of that Login button (where user clicks to start this process) when user allows DropBox. but i don't know how to do it.
Please let me know if this approach is Okay.
Thanks.
回答1:
You should use Dropbox's HTTP API directly. I am sure Dropbox provides a very easy to use API:
https://www.dropbox.com/developers/core
回答2:
Have you checked out their official "Saver Dropin"?
https://www.dropbox.com/developers/dropins/saver
If that does not fit your needs, check out their Core API
https://www.dropbox.com/developers/core/docs
If you don't want to write your own code to access the API you can try DropNet or Sharpbox.
NOTE: I have not used either of those libraries, but they are linked to directly from DropBox's Developer pages.
来源:https://stackoverflow.com/questions/24522682/using-dropbox-in-mvc-4