Reputation: 33
I'm currently developing a webapp with .NET 2012 using the Google Calendar API countering following error:
'Google.Apis.Drive.v2.DriveService' does not contain a definition for 'Scope'
you can find my code on: http://pastie.org/private/dfzb9wbayir3ponnnovlha
Any saint out there who wants to help me out?
Thanks in advance!
Upvotes: 3
Views: 1729
Reputation: 2791
If I create a project and install the Google Drive API, Scope is definitely available in DriveService, for example this compiles fine:
class Class1
{
private static readonly IAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "...........",
ClientSecret = "............"
},
Scopes = new[] { DriveService.Scope.Drive },
DataStore = new FileDataStore("Drive.Api.Auth.Store")
});
}
The only API using statements I have are:
using Google.Apis.Auth.OAuth2;
using Google.Apis.Auth.OAuth2.Flows;
using Google.Apis.Drive.v2;
using Google.Apis.Util.Store;
Which could imply there is something wrong with your installation.
Some pointers:
How have you installed the Drive API? Using NuGet? Try removing and adding it back in using NuGet package manager.
Are you on v1.6.0.107?
If you navigate to the definition of DriveService (Click on DriveService in the code -> F12), does the metadata imply it is there?
If you create a new project from scratch and install the API are you able to resolve Scope
on DriveService
?
Lastly, this seems to be more of problem with the Drive API rather than the Calendar, so you might want to rename the question and/or tags.
Update: The definition should contain the following:
To get the latest version, in Visual Studio go to:
Tools -> Library Package Manager -> Manage NuGet Packages for Solution (I'm using VS2012, should work in VS2010 also)
Choose Online, pick "Include Prereleased" and search for "Drive" as per below:
Google.APis.Drive.v2 Client Library should show up in the list. Install this. If the installation fails you likely don't have VS2012 Update 4 installed.
Upvotes: 1