- How to move a google doc into a folder using Zend Gdata
- $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
- $client = Zend_Gdata_ClientLogin::getHttpClient($gUser, $gPass, $service);
- $link = "https://docs.google.com/feeds/documents/private/full/spreadsheet:0AUFNVEpLOVg2U0E"; // Not real id for privacy purposes
- $docs = new Zend_GData_Docs($client);
- // Attach a category object of folder to this entry
- // I have tried many variations of this including attaching label categories
- $cat = new Zend_Gdata_App_Extension_Category('My Folder Name','http://schemas.google.com/docs/2007#folder');
- $entry = $docs->getDocumentListEntry($link);
- $entry->setCategory(array($cat));
- $return = $docs->updateEntry($entry,$entry->getEditLink()->href);
- $folder = "https://docs.google.com/feeds/documents/private/full/folder%3A0wSFA2WHc";
- $rel = "http://schemas.google.com/docs/2007#parent";
- $linkObj = new Zend_Gdata_App_Extension_Link($folder,$rel,'application/atom+xml', NULL,'Folder Name');
- $links = $entry->getLink();
- array_push($links,$linkObj);
- $entry->setLink($links);
- $return = $docs->updateEntry($entry,$entry->getEditLink()->href);
- // Folder you want to move too
- $folder = "https://docs.google.com/feeds/folders/private/full/folder%asdsad";
- $data = $docs->insertDocument($entry, $folder); // Entry is the entry you want moved using insert automatically assigns link & category for you...
- $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
- $client = Zend_Gdata_ClientLogin::getHttpClient($gUser, $gPass, $service);
- $docs = new Zend_GData_Docs($client);
- $link = "https://docs.google.com/feeds/documents/private/full/spreadsheet:0AUFNVEpLOVg2U0E";
- $entry = $docs->getDocumentListEntry($link);
- // Folder (Collection you want to move to)
- $folder = "https://docs.google.com/feeds/folders/private/full/folder%asdsad";
- // Move
- $data = $docs->insertDocument($entry, $folder);