Ejemplo n.º 1
0
        public static string CreateFolder(string folderName, string accessToken)
        {
            var dropboxFolder = new DropboxFolder(accessToken);

            if (dropboxFolder != null)
            {
                var folderTask = dropboxFolder.CreateFolder("/" + folderName);
                folderTask.Wait();
                if (folderTask.Result != null)
                {
                    return(folderTask.Result.Name);
                }
            }

            return("");
        }
Ejemplo n.º 2
0
        public static string RequestFileList(string dropboxFolder, string accessToken)
        {
            StringBuilder strfiles = new StringBuilder();

            // FolderContent folderContent = new FolderContent();
            List <FolderContent> folderContentList;

            try
            {
                var dropboxHelper = new DropboxFolder(accessToken);
                if (dropboxHelper != null)
                {
                    var folderTask = dropboxHelper.ListFolderContent(dropboxFolder);
                    folderTask.Wait();
                    if (folderTask.Result != null)
                    {
                        folderContentList = folderTask.Result;
                        // Files were obtained from dropbox so send tham back to the client to populate the combo box
                        foreach (var folderContent in folderContentList)
                        {
                            if (!folderContent.IsFolder)
                            {
                                if (folderContent.Path.StartsWith(("\\")))
                                {
                                    strfiles.Append(folderContent.Path + "¬");
                                }
                                else
                                {
                                    strfiles.Append(folderContent.Path.Substring(1) + "¬");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }



            return(strfiles.ToString());
        }