Google Drive API - 更改:列表.获取已删除文件的原始 ID [英] Google Drive API - Changes: list. Getting the original ID of a deleted file

查看:23
本文介绍了Google Drive API - 更改:列表.获取已删除文件的原始 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用 Changes: list feed 检测已删除的对象时,我注意到 id 值不正确,因此我无法检测到哪个文件被删除.示例:

When trying to detect deleted objects using the Changes: list feed, I noticed that the id value is incorrect making it impossible for me to detect which file was deleted. Example:

制作新的测试文件:这是一个测试文件

Make new testfile : This is a test file

public 'title' => string 'This is a test' (length=14)
public 'id' => string '1wUFHe3DfU1mJnyqlIgAYSvMrIy8F91-7rZyAPFsyVpg' (length=44)

现在,当我删除此文件时,删除更改的第一个条目是:

Now when I delete this file the first entry for a deleted change is:

public 'deleted' => boolean true
protected 'fileType' => string 'Google_Service_Drive_DriveFile' (length=30)
protected 'fileDataType' => string '' (length=0)
public 'fileId' => string '1_8Cvirw71AY0HQoaNwSMP3TlcIFAhpZikVfOrXFZCLo'        (length=44)
public 'id' => string '3612' (length=4)
public 'kind' => string 'drive#change' (length=12)
public 'modificationDate' => string '2013-12-23T10:55:45.340Z' (length=24)
public 'selfLink' => string 'https://www.googleapis.com/drive/v2/changes/3612' (length=48)
  protected 'modelData' => 
    array (size=0)
      empty
  protected 'processed' => 
    array (size=0)
      empty

没有一个标识符(fileIdid)等于文件这是一个测试文件"中的 id.我在 API 文档中读到结果是自下而上的,但没有删除的更改包含我的原始文件 ID.

None of the identifiers (fileId and id) equal the id from the file 'This is a test file'. I read in the API documentation that the results are from the bottom up, but non of the deleted changes contain my original file id.

我怎么知道哪个文件被删除了?

How would I know which file was deleted?

我制作了一个视频来展示我的问题和步骤

I've created a video showing my problems, steps

  • 我创建了一个新文件(就在视频开始之前)
  • 我在 Changes: 列表中显示了它的 ID
  • 我删除了这个文件
  • 我创建另一个文件
  • 我在 Changes: 列表中显示文件 ID
  • 更改:列表显示了我的第一个文件 ID,然后是第二个创建的文件 ID.不显示删除文件事件

https://www.youtube.com/watch?v=hh2ARFdxWGk

对不起,我使用了糟糕的屏幕录制工具

Sorry for the poor quality, I used a bad screen recording tool

推荐答案

您可以尝试使用 Apps Activity API 而不是 Changes.我刚刚使用 Apps Activity API 进行了测试,并且垃圾和 emptyTrash 都显示为事件.API Explorer 让您了解如何实现这一目标.

You might try using the Apps Activity API instead of Changes. I just tested with Apps Activity API and both trash and emptyTrash show as events. The API Explorer gives you an idea of how to achieve this.

这篇关于Google Drive API - 更改:列表.获取已删除文件的原始 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆