BurakD.
❔ Dropbox Refresh Access Token
using (var dbx = new DropboxClient(accessToken))
{
try
{
// Dropbox'a yüklemek istediğiniz dosya adını ve yolu belirtin
string fileName = Path.GetFileName(imagePath);
string dropboxPath = "/" + folderName + "/" + fileName;
try
{
var User = dbx.Users.GetCurrentAccountAsync();
}
catch (Exception ex)
{
MessageBox.Show( ex.Message );
}
using (var stream = new FileStream(imagePath, FileMode.Open))
{
// Upload the file to Dropbox
FileMetadata result = await dbx.Files.UploadAsync(
dropboxPath,
WriteMode.Overwrite.Instance,
body: stream
);
// Create a shared link for the uploaded file
Dropbox.Api.Sharing.SharedLinkMetadata sharedLink =
await dbx.Sharing.CreateSharedLinkWithSettingsAsync(dropboxPath);
// Get the URL of the shared link
string sharedLinkUrl = sharedLink.Url;
// Update the response model with the shared link URL
dropboxResponseModel.PhotoUrl = sharedLinkUrl;
dropboxResponseModel.UploadResult = true;
return dropboxResponseModel;
}
//
}
catch (Exception ex)
{
MessageBox.Show("Dropbox İşlemleri Sırasında Bir Hata Oluştu Lütfen Ayarlarınızı Kontrol Ediniz . Hata Sebebi : "+ ex.Message+ ex.InnerException );
return null;
}
}
4 replies