- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在使用来自 google Nuget 包 (Google.Apis.Drive.v3) 的 DriveService 时遇到问题。
我收到这个错误:
Severity Code Description Project File Line Suppression State Error CS1061 'BaseClientService' does not contain a definition for 'Files' and no extension method 'Files' accepting a first argument of type 'BaseClientService' could be found (are you missing a using directive or an assembly reference?) Sampleproject.Web C:\sample\Sampleproject.Web\Controllers\DriveController.cs 117 Active
我正在使用官方文档中的部分指南:https://developers.google.com/drive/v3/web/quickstart/dotnet#step_1_turn_on_the_api_name
最初我认为这只是我缺少的“用法”,但我似乎无法弄清楚/谷歌我的方法。
编辑:
最佳答案
我不确定您是如何创建服务
的,但您可以尝试:
我猜你正在做这样的事情。
// Create Drive API service.
var service = new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Drive Authentication Sample",
};
在这种情况下,您应该像这样声明服务。
// Create Drive API service.
var service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Drive Authentication Sample",
});
更新:
部分问题可能是您混合使用了 V2 和 V3。
using Google.Apis.Drive.v3;
列表:
var pageStreamer = new PageStreamer<Google.Apis.Drive.v3.Data.File, FilesResource.ListRequest, Google.Apis.Drive.v3.Data.FileList, string>(
(request, token) => request.PageToken = token,
response => response.NextPageToken,
response => response.Files);
var req = service.Files.List();
req.PageSize = 1000;
foreach (var result in pageStreamer.Fetch(req))
{
Console.WriteLine(result.Id);
}
关于c# - BaseClientService 不包含文件的定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37347422/
我在使用来自 google Nuget 包 (Google.Apis.Drive.v3) 的 DriveService 时遇到问题。 我收到这个错误: Severity Code Descriptio
我正在按照本页中提到的说明编写代码: https://developers.google.com/api-client-library/dotnet/get_started 按照上述资源中的这一行代码
我是一名优秀的程序员,十分优秀!