<c#>dropbox APIs

Source: Internet
Author: User

The first step is to activate the drive API

First, apply for Dropbox's account number, and second, get the app key and app Sercet you need to develop on Dropbox for developers.

1. Login to Dropbox for Developers website, 2, click the App console option, select Create APP;3, click Send Email for verification;4, verify by email, 5, in Create a new On the Dropbox Platform app, choose the Dropbox API app;6, fill in the information and create the app, and you'll get app key and app secret.

Step two, install the Dropbox Client Library

Install a NuGet package (dropnet). If VS2012 selects tools, then NuGet Package Manager, then Package Manager Console. Fill in the Pm> install-package dropnet-pre.

The third step, programming

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Windows.Forms;9 usingdropnet;Ten  One namespaceDropnetdemo A { -      Public Partial classForm1:form -     { the         #regionVar -         Privatedropnetclient _dropnetclient; -         #endregion -  +         #regionPrivate Property -         Privatedropnetclient m_dropnetclient +         { A             Get at             { -                 return_dropnetclient?? (_dropnetclient =Newdropnetclient (Tbxappkey.text, Tbxappsecret.text)); -             } -             Set -             { -_dropnetclient =value; in             } -         } to         #endregion +  -          PublicForm1 () the         { * InitializeComponent (); $         }Panax Notoginseng  -         Private voidBtnlogin_click (Objectsender, EventArgs e) the         { +             varCallbackurl ="https://www.dropbox.com/1/oauth/authorize"; A             varCancelcallbackurl ="Https://www.dropbox.com/home"; the             varSize =NewSize (1024x768, -); +  -             if(Dooauth (Callbackurl, cancelcallbackurl, size) = =DialogResult.OK) $             { $                 varAccesstoken =M_dropnetclient.getaccesstoken (); -             } -         } the  -         PrivateDialogResult Dooauth (stringCallbackurl,stringCancelcallbackurl, System.Drawing.Size Size)Wuyi         { the             using(varDialog =NewForm ()) -             { Wu                 varBROWESR =NewWebBrowser () -                 { AboutDock =DockStyle.Fill $                 }; -  - M_dropnetclient.gettoken (); -                 varAuthUrl =M_dropnetclient.buildauthorizeurl (); ABROWESR. navigated + = (s, ex) = = +                 { the                     varURL =Ex. Url.tostring (); -                     if(URL.) Equals (Callbackurl)) $                     { theDialog. DialogResult =DialogResult.OK; the                     } the                     Else if(URL.) Equals (Cancelcallbackurl)) the                     { -Dialog. DialogResult =DialogResult.Cancel; in                     } the                 }; the BROWESR. Navigate (AuthUrl); About  theDialog. Size =size; the dialog. Controls.Add (BROWESR); the  +                 returndialog. ShowDialog (); -             } the         }Bayi  the         Private voidTbxappkey_textchanged (Objectsender, EventArgs e) the         { -M_dropnetclient =NULL; -         } the  the         Private voidTbxappsecret_textchanged (Objectsender, EventArgs e) the         { theM_dropnetclient =NULL; -         } the     } the}

Finally, F5 runs
From: http://www.dotblogs.com.tw/larrynung/archive/2012/07/24/73580.aspx

Http://www.dotblogs.com.tw/larry/nung/archive/2012/08/08/73912.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.