Reputation: 1363
I have problem using the DriveService from google Nuget package (Google.Apis.Drive.v3).
I get this error:
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
I'm using parts of the guide from the official documentation: https://developers.google.com/drive/v3/web/quickstart/dotnet#step_1_turn_on_the_api_name
Initially i thought it was just a "usings" that i was missing, but i can't seem to figure out/google my way to which it is.
Edit:
And my usercredentials looks like this:
Upvotes: 2
Views: 4654
Reputation: 117156
I am not sure how you created your service
but you can try:
I am going to guess you are doing something like this.
// Create Drive API service.
var service = new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Drive Authentication Sample",
};
In which case you should be declaring the service like this.
// Create Drive API service.
var service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Drive Authentication Sample",
});
Update:
Part of your problem could be that you are mixing V2 and V3.
using Google.Apis.Drive.v3;
List:
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);
}
Upvotes: 1