Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to upload a document into Google docs using the Zend_Gdata plugin. It uploads fine.

But the document by default becomes private. How can I set it to public. And how can I get the doc id and URL link to my doc so that others can access it to view only?

$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client  = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, $service);
$docs    = new Zend_Gdata_Docs($client);
$feed    = $docs->getDocumentListFeed();

$newDocumentEntry = $docs->uploadFile(
    $filename, $name, null, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI
);

I appreciate any help.

Thanks

share|improve this question
Did you see my answer yet? – mmmshuddup Dec 23 '11 at 8:47

1 Answer

up vote 4 down vote accepted
+100

You must supply a different URI as the fourth parameter to the uploadFile() function, the one you're using will send docs to private. (Observe below)

Check out the source code from Zend_Gdata_Docs.

class Zend_Gdata_Docs extends Zend_Gdata
{
    const DOCUMENTS_LIST_FEED_URI 
        = 'https://docs.google.com/feeds/documents/private/full';
    // ...

As you can see, the class const is linking to a private path. Instead of using Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI, you would have to use public. However, according to Google's Documents List Feed API, it appears they only accept private.

The visibility parameter has two possible values: private and public.

Note: Currently, private is the only visibility available in the Documents List API. For more information, see Visibility values, below.


By the way, the end result should return a Zend_Gdata_App_Entry object to $newDocumentEntry with which I think you should be able to call functions like $newDocumentEntry->getEditLink() etc.

If you want to see what else is stored in that object that do this:

Zend_Debug::dump($newDocumentEntry);

Good luck!

share|improve this answer
thanx for your response. – Josh Randall Dec 24 '11 at 13:08
You're quite welcome. Are you going to aware the bounty? haha – mmmshuddup Dec 25 '11 at 1:04
1  
I am new.. sorry it took so long. I have awarded the bounty. – Josh Randall Dec 25 '11 at 7:52
Can we publish doc using gdata plugin. I appreciate all your help. Thanks. – Josh Randall Jan 27 '12 at 11:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.