简体   繁体   English

如何在云端硬盘中创建重定向到特定网址的快捷方式

[英]How can I create a shortcut in Drive that redirects to a specific url

I've been unsuccessfully trying to create a short cut in Drive that once you click on it, you get redirected to a specific url. 我一直没有尝试在Drive中创建快捷方式,一旦单击它,您就会被重定向到特定的网址。

Do you have an idea on how I might do that? 您是否知道我该怎么做?

Here is the code I started with : 这是我开始的代码:

  drive_service = build('drive', 'v2', http=http)

  # Insert a shortcut

  body = {
      'title': 'shortcut',
      'description': 'description',
      'mimetype': 'application/vnd.google-apps.drive-sdk',
  }
  file = drive_service.files().insert(body=body).execute()

It created the file but when I click on it in Drive it redirects me here: 它创建了文件,但是当我在云端硬盘中单击它时,它会将我重定向到此处:

'https://docs.google.com/file/d/{File ID}/edit'

You cant create a shortcut file unless is a custom file that opens by default by your previously-installed drive app. 除非是以前安装的驱动器应用程序默认打开的自定义文件,否则您无法创建快捷方式文件。
Else you could create the html for the anchor and use that as the html content for agoogle doc. 否则,您可以为锚创建html并将其用作agoogle doc的html内容。 See the official docs on how to do that, basically you create a new google doc with that html and specify convert=true. 有关如何执行此操作的信息,请参见官方文档,基本上,您可以使用该html创建一个新的google文档,并指定convert = true。
When the user opens the gdoc, she will need two more clicks to navigate to the url. 当用户打开gdoc时,她将需要再单击两次以导航到该url。

You control the open location of a shortcut file owned by your app via the Open URL template in the developer console entry. 您可以通过开发人员控制台条目中的“打开URL”模板来控制应用程序所拥有的快捷方式文件的打开位置。

See these pages on integrating with the Drive UI . 请参阅这些与Drive UI集成的页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM