简体   繁体   中英

Zend gData check if folder exist (Google Docs)

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
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM