有没有办法通过嵌入代码(我们为嵌入文档编写)或javascript/jquery 删除或禁用谷歌文档阅读器(在嵌入模式界面中使用时)的"在新窗口中打开"图标?
有没有人知道如何从Android应用程序共享Google Docs上的文档.任何人都可以提供完整的示例代码来共享Google文档上的文档吗?
我正在尝试使用OAuth 2.0访问Google的Documents List API 3.0,但我遇到了401错误的麻烦.
用户接受后,我的代码如下:
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CLIENT_ID);
oauthParameters.setOAuthConsumerSecret(CLIENT_SECRET);
oauthParameters.setOAuthToken(token);
oauthParameters.setOAuthTokenSecret(tokenSecret);
oauthParameters.setScope("https://docs.google.com/feeds/");
service = new DocsService("myapp");
service.setOAuthCredentials(oauthParameters, new OAuthHmacSha1Signer());
DocumentListFeed feed = service.getFeed(new URL("https://docs.google.com/feeds/default/private/full/?v=3"), DocumentListFeed.class);
Run Code Online (Sandbox Code Playgroud)
然后,在最后一行-getFeed() - 抛出异常:
com.google.gdata.util.AuthenticationException: Token invalid - Invalid token: Request token used when not allowed.
<HTML>
<HEAD>
<TITLE>Token invalid - Invalid token: Request token used when not allowed.</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Token invalid - Invalid token: Request token used when not allowed.</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)
这是怎么回事?在一个静态主测试类上工作就像一个魅力,但当我在服务器上运行它时,这条线不再起作用了.任何的想法?
解决了
需要使用GoogleOAuthHelper以这种方式检索访问令牌,而不是直接使用GoogleOAuthParameters:
String …Run Code Online (Sandbox Code Playgroud) 与此问题类似:Google Drive API如何支持下载请求的内容范围?
但是对于上传.如果要更新现有文件中的某些字节,Drive/Docs API是否允许您设置范围?
当我看到Gdrive时,还有一个用于安装Gdrive的保险丝客户端.我想知道,当通过这个客户端在Gdrive上修改文件时,文件是"锁定"还是以任何其他方式设置为"正在使用"以防止其他人修改互联网上的"原始"?我还没有发现任何相关信息.是不是有Google docs api的锁定方法?
Stef Bon
我要做的是运行一些JavaScript代码,将文本输入到Google文档中.到目前为止,我所做的是在我的个人网页上创建一个嵌入Google文档的iframe元素.我现在要做的是使用Google源代码中的函数来输入文本.
当我使用Chrome检查器和js美化器时,我发现如果我收听按键事件,我会被带到以下代码段:
function dKa() {
var a = eKa, b = TJa ? function(c) {
return a.call(b.src, b.key, c)
} : function(c) {
c = a.call(b.src, b.key, c);
if (!c)
return c
};
return b
}
Run Code Online (Sandbox Code Playgroud)
我试图在一个简单的onload="function();"事件加载页面时试图调用该函数,但是徒劳的尝试产生输出,但没有任何反应.有没有办法做我想做的事情?我想找到正确的函数来调用,这样我就可以通过该函数将文本写入doc.但是,代码似乎过于混淆,无法做任何事情.
我知道要从父框架引用Google文档(iframe)代码,我需要执行以下操作:document.getElementById("iframeID").contentWindow.theFunction()
我的执行错误了吗?据我所知,无法使用他们的API实时编辑Google文档.
这也是我第一次在这里发帖,所以如果这太模糊了,请告诉我,希望我能澄清一下.提前致谢.
javascript reverse-engineering google-docs google-docs-api google-apps-script
我使用ClientLogin方法和cURL登录google API.这工作正常,我收到一个令牌供进一步使用.我现在可以使用查询docs.google.com
$curl = curl_init();
$headers = array(
"Authorization: GoogleLogin auth=" . $auth,
"GData-Version: 3.0",
);
curl_setopt($curl, CURLOPT_URL, "https://docs.google.com/feeds/default/private/full");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
curl_close($curl);
Run Code Online (Sandbox Code Playgroud)
这工作正常,我得到了我的谷歌文档帐户中可用的所有文档的列表.但是,如果我使用从api文档中获取的URL对spreadsheets.google.com尝试相同的查询:
https://spreadsheets.google.com/feeds/spreadsheets/private/full
Run Code Online (Sandbox Code Playgroud)
我收到401错误,说明使用的令牌无效.我在两种情况下都使用相同的标记和查询.我是否需要为Google电子表格API提供不同的令牌?
编辑:这是我请求令牌的方式:
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
"accountType" => "HOSTED_OR_GOOGLE",
"Email" => "my email",
"Passwd" => "my password",
"service" => "writely",
"source" => "my application name"
);
$curl = curl_init($clientlogin_url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, …Run Code Online (Sandbox Code Playgroud) 我正在开发一款应用,可让Google Apps管理员重新分配文件的所有权.目前,我正在使用带有C#代码的Google Drive SDK for .NET.
当我在https://developers.google.com/drive/v2/reference/permissions/insert上的Google云端硬盘SDK测试演示中进行身份验证,并填写FileId属于管理员的文件,并尝试从其中插入另一个所有者Google Apps域我收到500内部服务器错误.我正在使用这些值:
POST https://www.googleapis.com/drive/v2/files/0B1Y4_hVm0vbESlZuZHhBemtjcXM/permissions?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer {MY_ACCESSTOKEN}
X-JavaScript-User-Agent: Google APIs Explorer
{
"role": "owner",
"type": "user",
"value": "user@mydomain.com"
}
Run Code Online (Sandbox Code Playgroud)
"试一试"演示为我设定了范围
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.file
做这个操作.
我可以通过使用经过身份验证的Try It演示作为相同的管理员用户获取该文件的权限列表,但我无法插入删除所有者权限.
我选择了Google Drive SDK,因为它更新,Google Docs API刚刚被删除,但我愿意使用任何更新所有权的最佳工具.我只是在寻找达到那个目标的最直接的道路.
有没有人获得所有权更新?如果是这样,你使用了什么工具?
在GoogleDrive中编辑文档后,似乎LastModified值有时不会立即更改.看起来价值将在几分钟内更新.
我试图通过DriveSDK获取文档的Etag,它也发生在Etag值上.
这种奇怪的行为使我无法实时获取文档状态(已修改或未修改).任何建议将受到高度赞赏.
[示例请求和响应]请求只是GoogleDrive ListFiles:https://www.googleapis.com/drive/v2/files
这是响应JSON的一部分,您可以看到ModifiedDate早于ModifiedByMeDate.
{
"kind": "drive#fileList",
"etag": "\"3NNCnvnQuji-pODa6SMQ6atlc3M/oKnf21kAcJKTCIycS597xCSR2bk\"",
"selfLink": "https://www.googleapis.com/drive/v2/files",
"items": [
{
"kind": "drive#file",
"id": "1lZjcJIf3Chuu5upFqtiqfTRnRw7*****rFL_tlO8A",
"etag": "\"3NNCnvnQuji-pODa6SMQ6atlc3M/MTM1NDY5MzMyMzQ1Mg\"",
"selfLink": "https://www.googleapis.com/drive/v2/files/1lZjcJIf3Chuu5upFqtiqfTRnRw7wSUjbRurFL_tlO8A",
"alternateLink": "https://docs.google.com/a/*****.com/document/d/1lZjcJIf3Chuu5upFqtiqfTRnRw7wSUjbRurFL_tlO8A/edit",
"embedLink": "https://docs.google.com/a/*****.com/document/d/1lZjcJIf3Chuu5upFqtiqfTRnRw7wSUjbRurFL_tlO8A/preview",
"iconLink": "https://ssl.gstatic.com/docs/doclist/images/icon_11_document_list.png",
"thumbnailLink": "https://docs.google.com/feeds/vt?gd=true&id=1lZjcJIf3Chuu5upFqtiq*****7wSUjbRurFL_tlO8A&v=22&s=AMedNnoAAAAAU*****UK74n3UiIg0L4TY-NwP3EaAU&sz=s220",
"title": "TestFile",
"mimeType": "application/vnd.google-apps.document",
"labels": {
"starred": false,
"hidden": false,
"trashed": false,
"restricted": false,
"viewed": true
},
"createdDate": "2012-07-24T08:14:13.918Z",
"modifiedDate": "2012-12-06T01:49:57.982Z",
"modifiedByMeDate": "2012-12-06T01:49:57.982Z",
"lastViewedByMeDate": "2012-12-06T01:50:06.974Z",
"parents": [
{
"kind": "drive#parentReference",
"id": "0AJ-aGTt-gWksUk9PVA",
"selfLink": "https://www.googleapis.com/drive/v2/files/1lZjcJIf3Chuu5upFqtiqfTRnRw7wSUjbRurFL_tlO8A/parents/0AJ-aGTt-gWksUk9PVA",
"parentLink": "https://www.googleapis.com/drive/v2/files/0AJ-aGTt-gWksUk9PVA",
"isRoot": true
}
],
"exportLinks": {
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "https://docs.google.com/feeds/download/documents/export/Export?id=1l*****huu5upFqtiqfTRnRw7wSUjbRurFL_tlO8A&exportFormat=docx",
"application/vnd.oasis.opendocument.text": …Run Code Online (Sandbox Code Playgroud) 是否可以在不获取整个电子表格的情况下获取已填充的行数,或找到第一个空行号?
如果有问题,我正在使用python api包装器。