Zend gData检查文件夹是否存在(Google Docs)

时间:2012-04-23 19:14:30

标签: php zend-framework google-docs gdata

我有这个代码来创建一个文件夹, 在创建它之前,我想检查这个文件夹是否已经存在!

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_AuthSub::getHttpClient($_SESSION['cal_token']);
$docs = new Zend_Gdata_Docs($client);
$docs->createFolder('My Folder');

我想要像

这样的东西
if($docs->isFolder('My Folder')) {
  //do something
}

1 个答案:

答案 0 :(得分:1)

Google文档中的文件夹由方案http://schemas.google.com/g/2005#kind和字词http://schemas.google.com/docs/2007#folder的类别标识:

<category scheme="http://schemas.google.com/g/2005#kind"
          term="http://schemas.google.com/docs/2007#folder"/>

您可以通过调用getCategory()列出所有类别并查找上述类别来检查条目是否为文件夹。