Tag: 谷歌云存储

Google Cloud Storage InsertMediaUpload Service BaseUri ArgumentNullException

我正在尝试将文件上传到Google云端存储中的存储桶。 我编写了以下代码来创建StorageService并将文件上传到存储桶。 GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer() { ClientSecrets = new ClientSecrets { ClientId = _googleSettings.ClientID, ClientSecret = _googleSettings.ClientSecret }, DataStore = new FileDataStore(System.Web.HttpContext.Current.Server.MapPath(“/App_Data”)), Scopes = new string[] { StorageService.Scope.DevstorageReadWrite }, }); UserCredential userCredentials = new UserCredential(flow, Environment.UserName, new TokenResponse()); StorageService service = new StorageService(new BaseClientService.Initializer() { HttpClientInitializer = userCredentials, ApplicationName = “GCS Sample” […]

从谷歌云url运行html文件

我已将html文件保存到具有公共读取权限的Google云存储中。 当我尝试打开html文件时,Chrome会自动在本地下载HTML文件,而不会在浏览器标签中打开它。 Html公共url是: https : //www.googleapis.com/download/storage/v1/b/presentationpublish/o/index_1112q_252_636703629560463983.html? generation = 1534766167109567 &alt = media 码: return storage.UploadObject( bucket: BucketName, objectName: objectName, contentType: “text/html”, source: valStream, options: new UploadObjectOptions { PredefinedAcl = publicRead } );

在c#中将对象上传到谷歌云存储桶

有人可以提供一个如何使用Google.Apis.Storage.v1将文件上传到c#中的google云存储的示例吗?