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

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

问题描述

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

创建新的测试文件:这是一个测试文件

 公共'标题'=>字符串'This is a test'(length = 14)
public'id'=>字符串'1wUFHe3DfU1mJnyqlIgAYSvMrIy8F91-7rZyAPFsyVpg'(长度= 44)

现在当我删除这个文件时,删除的更改为:

  public'deleted'=>布尔值true 
保护'fileType'=>字符串'Google_Service_Drive_DriveFile'(长度= 30)
保护'fileDataType'=>字符串''(长度= 0)
public'fileId'=>字符串'1_8Cvirw71AY0HQoaNwSMP3TlcIFAhpZikVfOrXFZCLo'(长度= 44)
public'id'=>字符串'3612'(长度= 4)
public'kind'=>字符串'drive#change'(长度= 12)
public'modificationDate'=>字符串'2013-12-23T10:55:45.340Z'(length = 24)
public'selfLink'=>字符串'https://www.googleapis.com/drive/v2/changes/3612'(length = 48)
保护'modelData'=>
array(size = 0)
empty
保护'processed'=>
array(size = 0)
empty

所有标识符( fileId id )等于文件'This'中的 id 是一个测试文件'。我在API文档中看到结果是自下而上的,但删除的更改中没有包含我的原始文件ID。



如何知道哪个文件被删除?



编辑:我创建了一个视频,显示我的问题,步骤


  • 我创建了一个新文件(就在视频开始之前)

  • 我在更改列表中显示它的ID

  • 我删除此文件
  • li>
  • 我创建另一个文件

  • 我在更改列表中显示文件ID

  • 更改:列表显示我的第一个文件ID,然后是第二个创建的文件ID。它不显示删除文件事件


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



抱歉质量不佳,我使用了一个不好的屏幕录制工具 您可以尝试使用 Apps Activity API 而不是更改。我刚刚使用Apps Activity API进行了测试,并将垃圾桶和emptyTrash显示为事件。 API Explorer 为您提供了一个如何实现这一点的想法。


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

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?

EDIT: I've created a video showing my problems, steps

  • I create a new file (just before the video started)
  • I show it's ID in the Changes: list
  • I delete this file
  • I create another file
  • I show the file ID in the Changes: list
  • The Changes: list shows my first file ID and right after that the second created file ID. It doesn't show to delete file event

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

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

解决方案

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天全站免登陆