Method not found: 'Void Google.Apis.Util.Store.FileDataStore..ctor(System.String)'
Posted
by
user3732193
on Stack Overflow
See other posts from Stack Overflow
or by user3732193
Published on 2014-06-12T00:15:52Z
Indexed on
2014/06/12
3:25 UTC
Read the original article
Hit count: 190
I've been stuck at this for days now. I copied the exact codes from google api samples to upload files to Google Drive. Here is the code
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = ClientId,
ClientSecret = ClientSecret,
},
new[] { DriveService.Scope.Drive,
DriveService.Scope.DriveFile },
"user",
CancellationToken.None,
new FileDataStore("MyStore")).Result;
But it would throw an exception at runtime: Method not found: 'Void Google.Apis.Util.Store.FileDataStore..ctor(System.String)'. I already added the necessary Google Api dlls.
Or if anyone could suggest a better code for uploading files to Google Drive in a website which implements Server-Side Authorization. Any help would be greatly appreciated.
UPDATE: I changed my code to this
var token = new TokenResponse { RefreshToken = "1/6hnki1x0xOMU4tr5YXNsLgutzbTcRK1M-QOTEuRVxL4" };
var credentials = new UserCredential(new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = ClientId,
ClientSecret = ClientSecret
},
Scopes = new[] {
DriveService.Scope.Drive, DriveService.Scope.DriveFile
}
}), "user", token);
But it also throws an exception: Method not found: 'Void Google.Apis.Auth.OAuth2.Flows.GoogleAuthorizationCodeFlow..ctor(Initializer). Is the problem with the dlls?
© Stack Overflow or respective owner