我正在尝试使用 Google Drive API v3 开发一个简单程序,该程序必须能够列出存储在用户“驱动器”中的所有文件,然后解释目录层次结构(这意味着:确定文件存储在哪个文件夹名称/ id中。
我遇到的问题是基本上# draw the line plot using ggplot
gg <-ggplot(plotbycity, aes(x = date, y = rent, group = city, color = city,
text = paste('Rent ($):', rent,
'<br>Date: ', as.Date(date),
'<br>Obs: ', count))) +
geom_line() +
ggtitle("Monthly Rents")
p <- ggplotly(gg, tooltip = c("text"))
属性(理论上包含文件存储位置的文件夹的ID)始终为空( nul )收到回复后,即使我确保在请求中指定File.Parents
值:
用C#编写的代码:
parents
用VB.NET编写的原始代码:
using Google.Apis.Drive.v3;
private DriveService client;
// ...
FilesResource.ListRequest request = this.client.Files.List();
request.PageSize = 100;
request.SupportsTeamDrives = false;
request.Fields = "nextPageToken, files(id, name, description, size,
trashed, shared, ownedByMe, isAppAuthorized,
createdTime, modifiedTime,
parents)";
FileList response = await request.ExecuteAsync();
此外,另外,其他属性如Imports Google.Apis.Drive.v3
Private client As DriveService
' ...
Dim request As FilesResource.ListRequest = Me.client.Files.List()
With request
.PageSize = 100
.SupportsTeamDrives = False
.Fields = "nextPageToken, files(id, name, description, size,
trashed, shared, ownedByMe, isAppAuthorized,
createdTime, modifiedTime,
parents)"
End With
Dim response As FileList = Await request.ExecuteAsync()
和File.CreatedTime
也是如此,我不明白为什么。其他属性如File.ModifiedTime
或File.Id
按预期工作......很好。
为什么File.Name
属性为nul,我该如何解决?我不想做什么?。
File.Parents
答案 0 :(得分:1)
尝试设置fields=*
并从那里向后工作。 https://developers.google.com/drive/v3/web/performance#partial提到了通配符,尽管该页面看起来已经过时了。