简体   繁体   English

使用Google Drive API的父母名单不完整

[英]Incomplete list of parents using Google Drive API

I'm looking to develop a web application using Google Drive API but I'm facing problems retrieving parents information about a file. 我希望使用Google Drive API开发Web应用程序,但是在检索有关文件的父母信息时遇到了问题。

I have a file called "File 1-1-1" that correspond to this path/tree structure : 我有一个名为“文件1-1-1”的文件,它对应于此路径/树结构:

"/Folder 1/Folder 1-1/File 1-1-1" “ /文件夹1 /文件夹1-1 /文件1-1-1”

Let's say this file has the ID "1234". 假设此文件的ID为“ 1234”。

When I ping Google API such as " https://www.googleapis.com/drive/v2/files/1234/parents ", all I get is this : 当我ping Google API(例如“ https://www.googleapis.com/drive/v2/files/1234/parents ”)时,我得到的只是这样:

{
  'kind' : 'drive#parentList',
  'etag' : etag,
  'selfLink' : selfLink,
  'items' : [
  {
    'kind' : 'drive#parentReference',
    'id' : '123', // ID of Folder 1-1
    'selfLink' : selfLink,
    'parentLink' : parentLink,
    'isRoot' : false
  }]
}

And that's it!!! 就是这样!!!

No reference to Folder 1!! 没有引用文件夹1!

If I keep getting deeper in the tree structure, I have the same problem : only one parent is returned. 如果我继续深入树结构,那么我会遇到同样的问题:仅返回一个父级。

Is there anything I'm doing wrong? 我做错了什么吗?

Thanks for your help. 谢谢你的帮助。

Cheers. 干杯。

EDIT 1 : 编辑1:

I've already seen this question Google Drive API (PHP): some files missing parent reference but my files/folders are not shared so that's not the answer unfortunately... 我已经看到了这个问题Google Drive API(PHP):有些文件缺少父级引用,但是我的文件/文件夹没有共享,所以不幸的是,这不是答案...

Parents returns the direct parent(s), not all ascendents. 父母返回直接父母,而不是所有上升者。 Folder 1 is the parent of Folder 1-1, not of File 1-1-1. 文件夹1是文件夹1-1的父文件夹,而不是文件1-1-1的父文件夹。 To get all ascendents you need to walk the tree. 要获得所有提升者,您需要走树。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM