c# - 是否有使用 Java、C#、Python 或 Ruby 编写的 Google Contacts API 的 Hello World 示例?

标签 c# java ruby google-api google-contacts-api

问题

谁能给我指出一个分步示例,该示例解释了如何开始使用 Google Contacts API 并展示了一个完整的工作演示?

最好使用 Java,但也可以使用 C#、Python 或 Ruby。

目标

我想做的就是

  1. 加载现有联系人,
  2. 将其添加到一个组中
  3. 保存联系人。

问题

我几乎在每个层面都失败了。

  • 无法进行身份验证
  • 找不到包含我在 Internet 上找到的代码片段中使用的类的库
  • 无法对现有联系人执行 CRUD 操作

示例

这是我正在寻找的一些伪代码。

import com.google.contacts.*

public class UpdateContactDemo {

   public static void main(String args[]) {
      GoogleContactsApi g = new GoogleContactsApi("username", "password");
      Contact c = g.get("Bob");
      c.addGroup("Friends");
      g.save(c);
   }
}

我已经做了什么

好吧,我用谷歌搜索了教程、API 示例和我能想到的所有其他内容,但都失败了。我找到了一堆这样的资源:

但不包含面向初学者的端到端示例。

最佳答案

我的 C# 方法是这样的:

http://nanovazquez.com/2013/01/18/working-with-google-calendar-on-dotnet/

代码可以在github上找到:here

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <appSettings>
    ...
    <!-- GoogleAPI credentials -->
    <add key="ClientId" value="{CLIENT-ID}" />
    <add key="ClientSecret" value="{CLIENT-SECRETD}" />

    <!-- Update the port of the Redirect URI (don't forget to set this value also in the Google API Console) -->
      <add key="RedirectUri" value="http://localhost:{PORT}/Account/GoogleAuthorization" />
  </appSettings>
  <system.web>
  ...
</configuration>
</xml>

您可以删除现有的 Google Calendar API 并添加 Google Contacts API。

试一试。

这有 Oauth 实现并且可以工作,但是 code.google.com 中的代码示例没有。

是迄今为止我发现的最好的。

关于c# - 是否有使用 Java、C#、Python 或 Ruby 编写的 Google Contacts API 的 Hello World 示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866172/

相关文章:

java 用正则表达式分割字符串

java - JPA cascade = REMOVE 和 Hibernate @OnDelete 一起使用?

java - 在 jar 之间共享内存

ruby - 乘客:内部服务器错误

ruby-on-rails - 我无法将 Rails 应用程序推送到 Heroku/安装 'pg' gem?

c# - 顶部 :? 的 CSS 问题

c# - 用于在 C# 中解析 SQL 查询的正则表达式

c# - 多线程 C# 应用程序日志文件锁定问题

函数参数中的Ruby解构

c# - SQL Server 2008 DATE 类型在 visual studio 中显示 DATE & TIME