0

I have this code to create a folder, Before creating it i would like to check if this folder doesn't already exists!

$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');

I would like something like

if($docs->isFolder('My Folder')) {
  //do something
}
Jerome Ansia
  • 6,854
  • 11
  • 53
  • 99

1 Answers1

1

A folder in Google Docs is identified by a category with scheme http://schemas.google.com/g/2005#kind and term http://schemas.google.com/docs/2007#folder:

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

You can check whether an entry is a folder by calling getCategory() to list all of its categories and looking for a category like the one above.

Claudio Cherubino
  • 14,896
  • 1
  • 35
  • 42