2013-05-14 53 views
0

我正在使用Google Drive的C#API V2,而且我似乎无法找到FilesResource.ListRequest.Fetch()方法...我发现FilesResource.ListRequest接口与google中描述的稍有不同驱动文档,所以我想对它做了一些改变,但没有反映在Web文档中。任何人都知道我现在应该如何执行查询?如何使用.NET Google Drive API执行查询?

这就是我试图运行:提前

public void SomeMethod(Settings settings) 
{ 
    var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description, settings.ApiKey, settings.ApiSecret); 
    var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, AuthProvider); 
    _driveService = new Google.Apis.Drive.v2.DriveService(new BaseClientService.Initializer {Authenticator = auth}); 

    var request = _driveService.Files.List(); 
    request.Q = "mimeType='application/vnd.google-apps.folder' and trashed=false"; 

    request.Fetch() // <-- This method does not exist! :/ 
} 

谢谢!

回答

2

使用execute()方法,而不是取指()

request.Execute() 
+0

截至2014年2月,.Execute方法似乎也从FilesResource.ListRequest中消失。我无法找到使用的替代方法。任何线索?确认我在VS2013的NuGet中使用最新的Google.Apis和Google.Apis.Drive。 –

0

当前方法似乎是ExecuteAsync

var request = _driveService.Files.List(); 
request.Q = "mimeType='application/vnd.google-apps.folder' and trashed=false"; 

var result = await request.ExecuteAsync() 

我不知道这是仅适用于Windows应用商店和Windows Phone 8.1的应用程序,或者如果Execute方法已经到处删除。

相关问题