Skip to content

Commit

Permalink
DropBox Cloud Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
KonduruKeerthi committed Jul 16, 2024
1 parent 522e02e commit 56b761a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public async Task<MemoryStream> GetDocumentFromDropBox()
//Define the access token for authentication with the Dropbox API
var accessToken = "Access_Token";

//Define the file path in Dropbox where the file is located
//Define the file path in Dropbox where the file is located. For ex: "/Template.pptx" or "/Apps/Template.pptx"
var filePathInDropbox = "FilePath";

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ public async Task<MemoryStream> UploadDocumentToDropBox(MemoryStream stream)
//Define the access token for authentication with the Dropbox API
var accessToken = "Access_Token";

//Define the file path in Dropbox where the file should be saved. For ex: "/Template.pptx" or "/Apps/Template.pptx"
var filePathInDropbox = "FilePath";

try
{
//Create a new DropboxClient instance using the provided access token
using (var dbx = new DropboxClient(accessToken))
{
//Upload the file to Dropbox
var uploadResult = await dbx.Files.UploadAsync("FilePath", WriteMode.Overwrite.Instance, body: new MemoryStream(stream.ToArray()));
var uploadResult = await dbx.Files.UploadAsync(filePathInDropbox, WriteMode.Overwrite.Instance, body: new MemoryStream(stream.ToArray()));
}
Console.WriteLine("Upload completed successfully");
}
Expand Down

0 comments on commit 56b761a

Please sign in to comment.