Hi All,
How view files in google drive from Local path folder in asp.net core web application.
The requirments is user uploading different format files like doc,pdf,excel,ppt ,after uploading user dont want to donwload the file ,user wants the view the files tab, so we trying to implement different files like doc,pdf,excel,pp to view in google drive from server local path folder or S3 bucket .
how can i achive this task .


Jayraj ChhayaRank #304 · 8.2K reputationPosted May 21, 2024, 2:04 AM EDT
To achieve this task, you can use the Google Drive API in your ASP.NET Core application. Here's a high-level overview of the steps involved:
// Code to upload a file to Google Drive // Make sure to authenticate and set up the DriveService var fileMetadata = new Google.Apis.Drive.v3.Data.File() { Name = "example.pdf" }; FilesResource.CreateMediaUpload request; using (var stream = new System.IO.FileStream("path_to_local_file.pdf", System.IO.FileMode.Open)) { request = driveService.Files.Create(fileMetadata, stream, "application/pdf"); request.Upload(); } var file = request.ResponseBody; Console.WriteLine("File ID: " + file.Id);Remember to handle authentication and authorization properly when interacting with the Google Drive API.
Vikas SinghRank #441 · 5.7K reputationPosted May 21, 2024, 6:49 AM EDT
@Venkat: Please check below article, hope this will sorted out your query.
https://www.c-sharpcorner.com/article/view-uploaded-files-in-google-drive-from-asp-net-core-app/