c #: google drive: google apis.services il vous manque un assembly ou une référence

J’essaie d’utiliser google.drive pour .net à l’aide de l’exemple Quickstart. J’ai installé les DLL via Nuget, mais je reçois le message d’erreur suivant: il me manque une référence ou un ensemble pour google.apis.service. Toute aide serait appréciée

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) { Ssortingng CLIENT_ID = "some_id"; Ssortingng CLIENT_SECRET = "some_secret"; // Register the authenticator and create the service var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description, CLIENT_ID, CLIENT_SECRET); var auth = new OAuth2Authenticator(provider, GetAuthorization); var service = new DriveService(new BaseClientService.Initializer() { Authenticator = auth }); File body = new File(); body.Title = "My document"; body.Description = "A test document"; body.MimeType = "text/plain"; byte[] byteArray = System.IO.File.ReadAllBytes("document.txt"); System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray); FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/plain"); request.Upload(); File file = request.ResponseBody; Console.WriteLine("File id: " + file.Id); Console.WriteLine("Press Enter to end this process."); Console.ReadLine(); } private static IAuthorizationState GetAuthorization(NativeApplicationClient arg) { // Get the auth URL: IAuthorizationState state = new AuthorizationState(new[] { DriveService.Scopes.Drive.GetSsortingngValue() }); state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl); Uri authUri = arg.RequestUserAuthorization(state); // Request authorization from the user (by opening a browser window): Process.Start(authUri.ToSsortingng()); Console.Write(" Authorization Code: "); ssortingng authCode = Console.ReadLine(); Console.WriteLine(); // Resortingeve the access token by using the authorization code: return arg.ProcessUserAuthorization(authCode, state); } } 

  1. Essayez d’exécuter notre Drive.Sample à partir de notre référentiel d’exemples – https://code.google.com/p/google-api-dotnet-client/source/browse/?repo=samples#hg%2FDrive.Sample . Vous pouvez y voir une implémentation fonctionnelle (elle inclut également le téléchargement de média et le code de téléchargement).

  2. Essayez de recommencer et d’installer les deux packages suivants (je ne sais pas si vous l’avez déjà fait): Google.Apis.Drive.v2 – https://www.nuget.org/packages/Google.Apis.Drive. v2 / Google.Apis.Authetnication – https://www.nuget.org/packages/Google.Apis.Authentication

MISE À JOUR (22 janvier 2014):

Nous avons réimplémenté la bibliothèque OAuth 2.0 et supprimé la dépendance dans DotNetOpenAuth il y a plusieurs mois. Vous pouvez en savoir plus à ce sujet dans le blog des annonces . Recherchez spécifiquement la version 1.6.0-beta.

Vous devriez également consulter la page OAuth 2.0 – https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2 .

Une autre bonne référence est notre référentiel d’échantillons. Tous les exemples ont été mis à niveau pour utiliser le nouveau package Google.Apis.Auth.