There is no UI for Service Accounts. The files are only accessible to your app.
where are my upload to google drive's files for service account
-
10-06-2023 - |
문제
I have the code below that uploads a file to my Google service account. It is working, but I want to know where is the file? Which account can I use to login to google drive and get the file and how much space can I use? Is there anything like google drive UI for service accounts?
private static Google.Apis.Drive.v2.Data.File insertFile(
String title,
String mimeType,
MemoryStream FileStream)
{
String serviceAccountEmail = "XXXXXX@developer.gserviceaccount.com";
var certificate = new X509Certificate2(
@"XXXXXXprivatekey.p12",
"notasecret",
X509KeyStorageFlags.Exportable);
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { DriveService.Scope.Drive }
}.FromCertificate(certificate));
// Create the service.
DriveService service = new DriveService(
new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Drive API Sample",
});
// File's metadata.
Google.Apis.Drive.v2.Data.File body =
new Google.Apis.Drive.v2.Data.File();
body.Title = title;
body.Description = title;
body.MimeType = mimeType;
FilesResource.InsertMediaUpload request =
service.Files.Insert(body, FileStream, mimeType);
request.Upload();
Google.Apis.Drive.v2.Data.File file = request.ResponseBody;
return file;
}
해결책
제휴하지 않습니다 StackOverflow