Ryan,

Thanks for sharing. Now, I am using as a batch for both insert and
update.

On May 6, 8:51 pm, Ryan Valdron <[email protected]> wrote:
> If you want to add them as viewers and not collaborators just change
> <gAcl:role value='writer'/> to <gAcl:role value='reader'/>.
>
> If  you want to change them from collaborator to viewer you'll have to
> write a method to PUT to
> /feeds/acl/private/full/document%3Adocument_id/user%3Anew_writer%40example.com
> (aka the user's edit link for that document).
>
> <entry xmlns="http://www.w3.org/2005/Atom";
> xmlns:gAcl='http://schemas.google.com/acl/2007'
>        xmlns:gd='http://schemas.google.com/g/2005'
>        gd:etag='W/"CUUNSXYyfCp7ImA9WxRVGUo."'>
>   <category scheme='http://schemas.google.com/g/2005#kind'
> term='http://schemas.google.com/acl/2007#accessRule'/>
>   <gAcl:role value='reader'/>
>   <gAcl:scope type='user' value='[email protected]'/>
> </entry>
>
> of if you want to batch it then use this and execute it as batch:
> <entry>
>     
> <id>http://docs.google.com/feeds/acl/private/full/document%3Adocument_id/...</id>
>     <batch:operation type='update'/>
>     <gAcl:role value='reader'/>
>     <gAcl:scope type='user' value='[email protected]'/>
>   </entry>
>
> more details are available 
> here:http://code.google.com/apis/documents/docs/2.0/developers_guide_proto...
>
> On Wed, May 6, 2009 at 5:59 AM, Phaung <[email protected]> wrote:
>
> > Ryan,
>
> > I got it works now. Thank so much for your quick reply. Have you ever
> > tried to change from collaborators to viewers?
>
> > On May 5, 8:22 pm, Ryan Valdron <[email protected]> wrote:
> >> What method were you using? I'm not 100% sure the batch one works as I
> >> didn't test it.
> >> I also have my own domain and am using it through there as well.
>
> >> Either way the URI passed in should be set 
> >> tohttp://docs.google.com/feeds/acl/private/full/document%3A".$id; 
> >> orhttp://docs.google.com/feeds/acl/private/full/document%3A".$id."/batch";;
>
> >> remember to set $id to the ID of the documents ingoogledocs. Maybe
> >> if you could echo what $uri is set to right before you make the call
> >> and send me what you have it set to I can help a bit more.
>
> >> On Tue, May 5, 2009 at 5:59 AM, Phaung <[email protected]> wrote:
>
> >> > I am trying to test your code. But I have my own domain name.
> >> > In that case, what the $uri parameter should be??
> >> > I get the error "Passed parameter is not a valid HTTP URI."
> >> > Thanks in advance.
>
> >> > On Apr 29, 11:44 pm, Ryan Valdron <[email protected]> wrote:
> >> >> Trav,
>
> >> >> If you're using theZendphpapi, I wrote a method in theDocsclass
>
> >> >> public function addContributor($data, $uri, 
> >> >> $className='Zend_Gdata_Entry'){
> >> >>     return $this->insertEntry($data, $uri, $className);
>
> >> >> }
>
> >> >> that works similar to insertDocument.
> >> >> where $uri = 
> >> >> "http://docs.google.com/feeds/acl/private/full/document%3A".$id;
> >> >> and $id is the document's ID.
>
> >> >> and $data follows this layout:
> >> >> <entry xmlns="http://www.w3.org/2005/Atom";
> >> >> xmlns:gAcl='http://schemas.google.com/acl/2007'>
> >> >>   <category scheme='http://schemas.google.com/g/2005#kind'
> >> >>     term='http://schemas.google.com/acl/2007#accessRule'/>
> >> >>   <gAcl:role value='writer'/>
> >> >>   <gAcl:scope type='user' value='[email protected]'/>
> >> >> </entry>
> >> >> as given in the developer's guide
> >> >> (http://code.google.com/apis/documents/docs/2.0/developers_guide_proto...).
>
> >> >> You could also do it in a batch run using this function (untested)
>
> >> >> public function executeBatch($data, $uri,
> >> >> $className='Zend_Gdata_App_Feed', $extraHeaders=array()){
> >> >>         $response = $this->post($data, $uri, null, null, $extraHeaders);
>
> >> >>         $returnFeed = new $className($response->getBody());
> >> >>         $returnFeed->setHttpClient(self::getstaticHttpClient());
>
> >> >>         $etag = $response->getHeader('ETag');
> >> >>         if (!is_null($etag)) {
> >> >>             $returnEntry->setEtag($etag);
> >> >>         }
>
> >> >>         return $returnEntry;
> >> >>     }
>
> >> >> in the App class. Where $data is laid out according to the link above
> >> >> and $uri is the same as above with /batch at the end of it.
>
> >> >> Either way you're going to have to adjust the scope in theDocs
> >> >> implementation from $scope = 'http://docs.google.com/feeds/documents';
> >> >> to $scope = 'http://docs.google.com/feeds/';inorderfor either
> >> >> function to work.
>
> >> >> -Ryan
>
> >> >> On Wed, Apr 29, 2009 at 12:21 PM, Trav <[email protected]> wrote:
>
> >> >> > Hi,
>
> >> >> > I have completed the portion of my application that uploads a document
> >> >> > toGoogleDocswith the PHPapi, However, I need to invite
> >> >> > collaborators to the document automatically through PHP, how can I
> >> >> > accomplish this?
>
> >> >> > I am usingGoogledocson my own domain throughGoogleApps. The
> >> >> > collaborators that I need to invite will all be in the same domain.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to