Ejemplo n.º 1
0
        private static async Task Run()
        {
            var client = new CopyClient(
                new Config
            {
                CallbackUrl    = "https://www.yourapp.com/Copy",
                ConsumerKey    = ConsumerKey,
                ConsumerSecret = ConsumerSecret,

                //Token = Token,
                //TokenSecret = TokenSecret
            });

            // Perform authorization (alternatively, provide a Token and TokenSecret in the Config object passed to CopyClient
            await Authorize(client);

            // Retrieve information on the logged-in user
            var user = await client.UserManager.GetUserAsync();

            // Retrieve the root folder of the logged-in user
            var rootFolder = await client.GetRootFolder();

            foreach (var child in rootFolder.Children)
            {
                var childInfo = await client.FileSystemManager.GetFileSystemInformationAsync(child.Id);
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> About()
        {
            ViewBag.Message = "Your app description page.";

            string verifier = Request.QueryString["oauth_verifier"];

            if (!string.IsNullOrEmpty(verifier))
            {
                Authentication.CopyAuth copyConfig = (Authentication.CopyAuth)Session["copyConfig"];

                CopyClient copyClient = await copyConfig.GetAccessTokenAsync(verifier);

                Session.Add("copyClient", copyClient);

                FileSystem rootFolder = await copyClient.GetRootFolder();
            }
            else if (Session["copyClient"] != null)
            {
                //CopyClient copyClient = (CopyClient) Session["copyClient"];

                //FileSystem rootFolder = await copyClient.GetRootFolder();
            }

            return(View());
        }