有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Google Contacts API在Java、C#、Python或Ruby中是否有一个Hello World示例?

问题

谁能给我举一个循序渐进的例子,说明如何开始使用GoogleContactsAPI,并展示一个完整的工作演示

最好使用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示例和我能想到的所有东西,但都失败了。我找到了一大堆类似的资料:

但其中包含一个面向初学者的端到端示例


共 (1) 个答案

  1. # 1 楼答案

    我的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日历api并添加Google联系人api

    试试这个

    这有Oauth实现,并且可以工作,但是代码是从代码中抽取样本的。谷歌。不要

    是目前为止我找到的最好的