public Drive(IServiceAccountApplication saApp) { credential = DriveCredentialsService.GetServiceAccountCredential(saApp); service = DriveCredentialsService.GetService(saApp); application = saApp; }
public static ServiceAccountCredential GetServiceAccountCredential(IServiceAccountApplication saApp) { var certificate = new X509Certificate2(saApp.PrivateKey, "notasecret", X509KeyStorageFlags.Exportable); ServiceAccountCredential credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(saApp.ServiceAccountMail) { Scopes = new[] { DriveService.Scope.DriveFile, DriveService.Scope.Drive } }.FromCertificate(certificate)); return(credential); }
public static DriveService GetService(IServiceAccountApplication saApp) { return(GetService(GetServiceAccountCredential(saApp), saApp)); }