Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:08:32+00:00 2026-06-05T02:08:32+00:00

Hi Guys I am really struggling with moving a document from my root folder

  • 0

Hi Guys I am really struggling with moving a document from my root folder to another folder using zend gdata here is how i am trying to do it, but its not working.

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

When I run this I get No errors, but nothing seems to change, and the return data does not contain the new category.

EDIT:
Ok I realised that its not the category but the link that decides which “collection” (folder) a resource belongs too. https://developers.google.com/google-apps/documents-list/#managing_collections_and_their_contents says that each resource has as et of parent links, so I tried changing my code to do set link instead of set category, but this did not work.

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

EDIT: SOLVED [nearly]
OK Here is how to move/copy, sort of, from one folder to another:
simpler than initially thought, but problem is it creates a reference and NOT a move! It now in both places at the same time….

// 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...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:08:33+00:00Added an answer on June 5, 2026 at 2:08 am

    To copy/ move a file into a folder do the following:

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

    Now some issues are:

    1. It seem to make reference copy only, this means its still the same document only it has an extra category and parent link (so its now in two places). This may explain it better: https://groups.google.com/forum/embed/?place=forum/google-documents-list-api#!topic/google-documents-list-api/OrLi2JCINw4

    I am sure there must be a way to do it “cleaner”/better but at least it moves it for now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok guys, I'm starting to be really good at using PHP, but I really
heyy guys.... i know this is probably a silly error but i really tried
Ok guys, I know this is pretty a rare case but I really would
Hey guys, I'm reviewing some questions but I can't really figure it out, i
Guys I have been trying lots of different options from cutting up to building
I was wondering what strategies you guys are using to fix runtime errors? Really
Ok guys I'm really at a dead end here, don't know what else to
Hy guys, I'm trying to generate a Zip File with ICSharpCode.SharpZipLib library but it's
Guys!! I'm really enthusiastic in learning django and learnt a bit on Django-1.2 but
hey guys, i spent some time on this one but i find it really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.