I am having a problem to upload to any folder other than root in Dropbox using SharpBox. I can upload using this path var publicFolder = dropBoxStorage.GetFolder("/");
, but not to folder created in root, such as "/MyFolder". I can enumerate files using this path var publicFolder = dropBoxStorage.GetFolder("/MyFolder");
, but not upload there. Exception says: not authorized. How do I assign permissions to folders in root or is the problem in the app permissions? I appreciate any help.
Steps:
Here is the code:
CloudStorage dropBoxStorage = new CloudStorage();
var dropBoxConfig = CloudStorage.GetCloudConfigurationEasy(nSupportedCloudConfigurations.DropBox);
ICloudStorageAccessToken accessToken = null;
// load security token from file
using (FileStream stream = File.Open(@"<<token file location>>", FileMode.Open, FileAccess.Read, FileShare.None))
{
accessToken = dropBoxStorage.DeserializeSecurityToken(stream);
}
// open connection
var storageToken = dropBoxStorage.Open(dropBoxConfig, accessToken);
var publicFolder = dropBoxStorage.GetFolder("/MyFolder");
//upload file
dropBoxStorage.UploadFile("<<source path>>", publicFolder);
dropBoxStorage.Close();`
将.NET Framework从4.5更改为4解决了我的问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.