Tag: 谷歌驱动 SDK

如何从Google云端硬盘下载文件

我目前正在尝试制作一个从Google云端硬盘下载文件的应用程序。 在Google Drive SDK文档中,我找到了一个应该返回System.IO.Stream对象的示例方法。 https://developers.google.com/drive/manage-downloads 为此,它需要每个文件的下载URL。 但是,并不总是指定返回此下载URL。 有没有人知道为什么会这样? 我能做些什么呢? 更新:我发现我可以使用exportURL。 这几乎总是由服务返回。 Folowup问题:如何以特定用户身份运行应用程序? =>有时应用会向url发出请求,然后请求超时。 当我在浏览器中尝试相同的URL时,它就像一个魅力…… 谢谢!

Google API使用身份validation服务帐户上传文件

我正在尝试通过API Google Drive发送文件,但是,我找不到任何有关如何使用身份validation服务帐户执行C#上传文件的文档。 我下载了Daimto库,但是,当我们使用身份validationClientId和ClientSecret时,他使用DriveService类上传。 但是使用身份validation进行帐户服务后,他返回到PlusService类,发现无法以这种方式上传文件。 有人能帮我吗? 最好的祝福 使用validation服务帐户 public PlusService GoogleAuthenticationServiceAccount() { String serviceAccountEmail = “106842951064-6s4s95s9u62760louquqo9gu70ia3ev2@developer.gserviceaccount.com”; //var certificate = new X509Certificate2(@”key.p12″, “notasecret”, X509KeyStorageFlags.Exportable); var certificate = new X509Certificate2(@”key.p12″, “notasecret”, X509KeyStorageFlags.Exportable); ServiceAccountCredential credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(serviceAccountEmail) { Scopes = new[] { PlusService.Scope.PlusMe } }.FromCertificate(certificate)); // Create the service. var service = new PlusService(new BaseClientService.Initializer() […]

如何使用.NET API在Google云端硬盘中创建文件夹?

我正在使用C#,Google .NET API。 如何在Google云端硬盘根位置创建文件夹? 任何代码都会有所帮助。 谢谢

Google云端硬盘 – 如何从代码中清空垃圾(以编程方式)?

请帮我将项目与Google云端硬盘集成。 问题是Google云端硬盘文件夹永远不会被清空,因此由于空间不足,Google Drive与桌面同步最终会停止运行。 我需要配置垃圾桶不保留已删除的文件(首选选项)或以编程方式从C#代码(不太喜欢)或其他编程语言(最后选项)清空它。 如何从代码或脚本或其他内容中清空Google云端硬盘垃圾箱?

使用Google Drive API获取文件夹层次结构

我正在寻找一种优雅的方式来获取文件夹层次结构,从我的根文件夹开始,使用C#Google Drive API V3。 目前,您可以通过以下方式获取根文件夹及其父文件夹 var getRequest = driveService.Files.Get(“root”); getRequest.Fields = “parents”; var file = getRequest.Execute(); 但我正在寻找一种方法来获得孩子,而不是父母,所以我可以递归下去文件结构。 设置getRequest.Fields = ‘children’不是有效的字段选项。

如何以编程方式提供凭据以在c#或vb.net中使用google drive api?

我制作了一个程序,使用谷歌驱动器api从谷歌驱动器上的文件中读取数据。 第一次运行应用程序时,它会打开一个Web浏览器,要求使用google驱动器帐户登录。 我想为应用程序提供用户名和密码,以便自动获取凭据,以便用户无需知道我的Google云端硬盘帐户的用户名和密码。 这是vb.net中的代码: Dim credential As UserCredential Using stream = New FileStream(“client_secret.json”, FileMode.Open, FileAccess.Read) Dim credPath As String = System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal) credPath = Path.Combine(credPath, “.credentials/drive-dotnet-quickstart.json”) credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, “user”, CancellationToken.None, New FileDataStore(credPath, True)).Result ‘Console.WriteLine(“Credential file saved to: ” + credPath) End Using //I want to provide the username and password in the […]

c#:google drive:google apis.services你错过了程序集或引用

我正在尝试使用快速启动示例使用google.drive for .net。 我已经通过nuget安装了dll,但是我收到以下错误,我错过了google.apis.service的引用或程序集。 任何帮助,将不胜感激 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using DotNetOpenAuth.OAuth2; using Google.Apis.Authentication.OAuth2; using Google.Apis.Authentication.OAuth2.DotNetOpenAuth; using Google.Apis.Drive.v2; using Google.Apis.Drive.v2.Data; using Google.Apis.Util; using Google.Apis.Services; public partial class Default3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { String CLIENT_ID […]

为什么我得到System.UnauthorizedAccessException拒绝访问路径’Google.Apis.Auth’被拒绝

我已经为文件管理实现了谷歌驱动器function,它在本地系统中工作正常,但每当我在Godaddy服务器上托管它时,它会抛出以下错误 System.UnauthorizedAccessException拒绝访问路径“Google.Apis.Auth”。 以下代码我正在使用: UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = System.Configuration.ConfigurationManager.AppSettings[“GDriveClientId”],//Get ClientID from web.config. ClientSecret = System.Configuration.ConfigurationManager.AppSettings[“GDriveClientSecret”]//Get ClientSecret from web.config. }, new[] { DriveService.Scope.Drive }, System.Configuration.ConfigurationManager.AppSettings[“GDriveCreatedByUser”],//Get UserName from web.config. CancellationToken.None).Result; return credential; 我正在使用VS2010,IIS 7来实现上述function

.NET Google api 1.7 beta使用刷新令牌进行身份validation

我一直在关注Oauth .Net Google Apis,以便通过OAuth进行身份validation并使用Google驱动Apis。 具体来说,我想使用我已经存储的刷新令牌,以便使用它来实例化GoogleDrive服务。 我找到了像https://code.google.com/p/google-api-dotnet-client/source/browse/Tasks.SimpleOAuth2/Program.cs?repo=samples这样的示例 这似乎使用“GoogleWebAuthorizationBroker.AuthorizeAsync”,但我不确定如何使用该方法使用刷新令牌而不是您在此示例中似乎提供的客户机密码。

如何使用C#以编程方式找到我的Google云端硬盘文件夹?

类似的问题在这里 。 仅适用于Google Drive而不是Dropbox : 如何使用C#以编程方式找到我的Google Drive文件夹? 注册? 环境变量? 等等…