【问题标题】:Accessing the current users Google Apps Domain from within a GMail gadget从 GMail 小工具中访问当前用户的 Google Apps 域
【发布时间】:2010-08-16 07:19:05
【问题描述】:

我正在开发 GMail 小工具,并尝试访问当前用户 ComanyName / Apps-Account-DomainName / ID。它必须是属于同一 Google Apps 域的所有用户的唯一 ID,因为我喜欢向同一域/公司中的不同用户显示不同的内容。

你知道这是否以及如何实现?

据我了解,GMail 侧边栏小工具无法访问任何当前用户数据。它们只是显示在 gmail 中,但不与之交互。

除非您使用 OAuth 对用户进行身份验证。

这个例子展示了如何获取用户的联系人:

http://gadget-doc-examples.googlecode.com/svn/trunk/opensocial-gadgets/oauth-contacts.xml

观察您将看到的代码,它使用提要访问此数据:

http://www.google.com/m8/feeds/contacts/default/base?alt=json

所以也许我的问题是:“我必须访问哪个提要才能获取用户的 Google Apps 域?”否则:有可能吗?

【问题讨论】:

    标签: gmail google-api google-apps google-gadget


    【解决方案1】:

    这段代码解决了我的问题:

    var domain = gadgets.util.getUrlParameters()['parent'].match(/.+\/a\/(.+)\/html/)[1];
    

    在这里找到答案:

    http://www.google.com/support/forum/p/apps-apis/thread?tid=3d0d1c7033431d79&hl=en

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      • 2010-12-09
      • 1970-01-01
      • 1970-01-01
      • 2012-03-15
      相关资源
      最近更新 更多