how can I get share link after sharing a file with authorization keys

137 views
Skip to first unread message

ling Zou

unread,
Mar 28, 2012, 4:40:44 AM3/28/12
to google-docum...@googlegroups.com
I shared a file by withKey method, and I need the share link to display the file in other place,
but there's no share link information in the HttpResponseMessage.
how could I get it?
 
 <entry>
 
<gAcl:withKey key=‘with link’><gAcl:role value='reader' /></gAcl:withKey>
 
<gAcl:scope type='default' />
</entry>

Claudio Cherubino

unread,
Mar 28, 2012, 12:33:04 PM3/28/12
to google-docum...@googlegroups.com
Hi Ling,

The share link must be constructed by concatenating the alternate link + '?authkey=' + key.
Please also check these threads:


Claudio

Claudio Cherubino

unread,
Mar 28, 2012, 12:41:20 PM3/28/12
to google-docum...@googlegroups.com
Hi Ling,

Looks like I was wrong, we don't authkey anymore, instead you should be able to just use the alternate link.

Claudio

ling Zou

unread,
Mar 28, 2012, 10:00:51 PM3/28/12
to google-docum...@googlegroups.com
Hi Claudio:
   thank you. Do you mean the share link is nothing to do with the ACL key? then anyone has the alternate link could open the document?
 
 

在 2012年3月29日星期四UTC+8上午12时41分20秒,Claudio Cherubino写道:

Ali Afshar

unread,
Mar 29, 2012, 1:22:05 PM3/29/12
to google-docum...@googlegroups.com
Hi Ling,

Yes, that is exactly right, anyone with the link can access the role for that ACL, the key itself is not used. If you remove that ACL, and add it again, the link would be new, so it would be like a revokable token.

Regards
--
Ali Afshar | www.googplus.org/ali | Google Developer Relations

Fernando Benavides

unread,
Apr 3, 2012, 12:33:01 PM4/3/12
to google-docum...@googlegroups.com
Hi Ali

Could you please  give some examples about this "alternative link" , its because , in all the forums   (https://groups.google.com/forum/#!topic/google-documents-list-api/xeoI59v_lUM/discussion ) people talk about the ACL key to achive "anyone with the link can view the document", but i am having a hard time to achive that.

Thanks.


2012/3/29 Ali Afshar <afs...@google.com>

Fernando Benavides

unread,
Apr 3, 2012, 3:04:45 PM4/3/12
to google-docum...@googlegroups.com
This does not exist in c# , how i can it make the same in c#

AclEntry aclEntry = new AclEntry();
aclEntry.setScope(scope);
AclWithKey withKey = new AclWithKey("gspot", role);
aclEntry.setWithKey(withKey);
service.insert(aclFeedUrl, aclEntry);



2012/4/3 Fernando Benavides <nan...@gmail.com>

Claudio Cherubino

unread,
Apr 3, 2012, 5:45:14 PM4/3/12
to google-docum...@googlegroups.com
Hi Fernando,

The .NET GData client library doesn't support AclWithKey.

Claudio

Fernando Benavides

unread,
Apr 3, 2012, 6:42:04 PM4/3/12
to google-docum...@googlegroups.com
Hi Claudio , so how can i accomplish "share to anyone with the link" with .net Gdata client library?


this link documento.AtomEntry.Links[0], in which REL value is "alternative" , do not work for me.






2012/4/3 Claudio Cherubino <ccher...@google.com>

Claudio Cherubino

unread,
Apr 3, 2012, 7:20:20 PM4/3/12
to google-docum...@googlegroups.com
Hi Fernando,

In order to share to anyone with the link, you need to POST to the ACL feed:

POST /feeds/default/private/full/document:1234/acl

<entry>
  <gAcl:withKey key="doesn't matter">
    <gAcl:role value='reader'/>
  </gAcl:withKey>
  <gAcl:scope type='default'/>
</entry>

However, the .NET library doesn't support the gAcl:withKey element, so you won't be able to do so, unless you define the element yourself.
Note that it doesn't matter what the value of the key attribute is, it just needs to be something.

Claudio

Fernando Benavides

unread,
Apr 4, 2012, 2:12:13 AM4/4/12
to google-docum...@googlegroups.com
hello Claudio , i being trying to define the element myself , without success , i need a light , i have try extended property , xmlnode , but any of this work

       this is in java , in c# setBlob()  does not exist , what can i use?     
                  
  
XmlBlob blob = new XmlBlob();
    // the suggested key is ignored - google generates their own which we then retrieve
    blob.setBlob("<gAcl:withKey key='whatever'><gAcl:role value='" + AclRole.WRITER.getValue() + "' /></gAcl:withKey>");
    blob.addNamespace(new XmlNamespace("", "http://www.w3.org/2005/Atom")
);
    blob.addNamespace(new XmlNamespace("gAcl", "http://schemas.google.com/acl/2007"));

Thanks.
Reply all
Reply to author
Forward
0 new messages