使用 Zend GData 从垃圾箱恢复 Google 文档
我正在创建一个使用 Google 文档进行存储的文件管理器,但我很难弄清楚如何恢复已发送到垃圾箱的文件。我可以使用此代码发送到垃圾箱:
$resourceId = "file:12345";
$link = "https://docs.google.com/feeds/default/private/full/";
$file = $docs->getDocumentListEntry($link.$resourceId);
$file->delete();
然后我可以使用以下方式查看所有已垃圾文件:
$docs = new Zend_Gdata_Docs($client);
$docs->setMajorProtocolVersion(3);
$feed = $docs->getDocumentListFeed($link."-/trashed");
foreach($feed->entries as $entry) {
...
}
我的问题是,我如何才能将这些文件之一恢复到删除之前的位置,就像在 Google 文档中一样?
I am creating a filemanger that uses Google Docs for storage, but I am having difficulty working out how to restore a file that has been sent to the trash. I can send to trash by using this code:
$resourceId = "file:12345";
$link = "https://docs.google.com/feeds/default/private/full/";
$file = $docs->getDocumentListEntry($link.$resourceId);
$file->delete();
I can then view all trashed documents using:
$docs = new Zend_Gdata_Docs($client);
$docs->setMajorProtocolVersion(3);
$feed = $docs->getDocumentListFeed($link."-/trashed");
foreach($feed->entries as $entry) {
...
}
My question is how can I then restore one of these files back to location it was before it was deleted as you can in Google Docs proper?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我弄清楚了如何在我的 Google 文档应用程序中恢复已删除的文件。代码如下:
这也适用于取消文档和其他类别元素的星号。例如:
替换:
为:
Ok, so I worked out how to restore trashed files in my Google Docs App. Code is as follows:
This will also work for unstarring a document and with other category elements. So for example:
Replace:
With: