java 从java中的hotmail gmail yahoo获取联系人列表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/397933/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Taking contact list from hotmail gmail yahoo in java?
提问by Shonzilla
most of social networks does this. when you register one of them for example twitter it says why dont you invite your friends from hotmail or yahoo or gmail. and expect us to give our credentials and send those mails. I want to implement same feature in java.
大多数社交网络都是这样做的。当您注册其中之一时,例如 twitter,它会说您为什么不从 hotmail、yahoo 或 gmail 邀请您的朋友。并期望我们提供我们的凭据并发送这些邮件。我想在java中实现相同的功能。
I tried http://code.google.com/p/contactlistimporterbut it has a problem with hotmal.
我尝试过http://code.google.com/p/contactlistimporter,但它在使用 hotmal 时有问题。
can you suggest me nice another library ?
你能给我推荐另一个图书馆吗?
回答by Shonzilla
Each of these email providers has its own API:
这些电子邮件提供商中的每一个都有自己的 API:
- GMail: Google Contacts Data API- Google Contacts API version 3.0
- Yahoo! Mail: Yahoo! Address Book API- Developer's Guide
- Hotmail: Windows Live Contacts API Beta- API Reference
- GMail:Google 通讯录数据 API- Google 通讯录 API 3.0 版
- 雅虎!邮件:雅虎!地址簿 API-开发人员指南
- Hotmail:Windows Live 联系人 API 测试版- API 参考
There are usually Java samples that you can use to start your work. I've been using Google Data API to successfully download my GMail contacts and Google Docs&Spreadsheets.
您通常可以使用 Java 示例来开始您的工作。我一直在使用 Google Data API 来成功下载我的 GMail 联系人和 Google Docs&Spreadsheets。
There seem to be commercial Java libraries for what you're asking for. Some of them are:
似乎有您所要求的商业 Java 库。他们之中有一些是:
- Contacts Importerfrom Malasian Octazenthat supports 30+ web mails in total (with a price tag of $234US) whereas the version you're looking for would cost $88US.
- another Contacts Importerfrom Indian Improsysthat supports less "networks" and Java version costs $550.
- 来自 Malasian Octazen 的Contacts Importer总共支持 30 多个网络邮件(标价为 234 美元),而您正在寻找的版本将花费 88美元。
- 另一个来自 India Improsys 的Contacts Importer支持较少的“网络”和 Java 版本,价格为 550 美元。
I'm not aware of any open-source Java libraries offering a general access to all of these three email providers. There's one for PHP called Open Inviterwhich supports 10+ networks(if the big three you mentioned could be considered as such at all).
我不知道有任何开源 Java 库提供对所有这三个电子邮件提供商的一般访问。PHP 有一个叫做Open Inviter,它支持 10 多个网络(如果你提到的三大网络都可以被认为是这样的话)。
Also, Plaxohas kicked off an effort called Portable Contacts(and draft specificationlooks promising) but this is at a very early stage. Anyway, I wouldn't Portable Contacts to solve your problem and that won't happen in the next 6+ months anyway. It's something they're doing to advance their business in backing up peoples' address books, creating a more natural network around it and advancing data portability in general with such a strong competition from Google, Facebook and MySpace.
此外,Plaxo已经开始了一项名为Portable Contacts 的工作(并且草案规范看起来很有希望),但这还处于非常早期的阶段。无论如何,我不会使用便携式通讯录来解决您的问题,而且无论如何在接下来的 6 个月内都不会发生这种情况。这是他们正在做的事情,以推进他们在备份人们的地址簿方面的业务,围绕它创建一个更自然的网络,并在来自谷歌、Facebook 和 MySpace 的如此激烈的竞争中提高数据的可移植性。
Other than that, I don't think there's anything feasible at the time of this writing. Otherwise I would find it. ;-)
除此之外,我认为在撰写本文时没有任何可行的方法。否则我会找到它。;-)
Cheers!
Shonzilla
干杯!
松齐拉
回答by Tarun Nagpal
Try this:
试试这个:
socialauth is a java library that allows importing contacts from Google, Yahoo or Hotmail. http://code.google.com/p/socialauth/
socialauth 是一个 Java 库,允许从 Google、Yahoo 或 Hotmail 导入联系人。http://code.google.com/p/socialauth/
回答by lucas
Why don't you look @ the OpenSocial API?
你为什么不看看@OpenSocial API?
回答by Ole
Most webmail providers offer an option to export the contacts for backup purposes.
大多数网络邮件提供商都提供了导出联系人以进行备份的选项。
Your application would need to ask for the user's credentials, then it could fetch the contact backup (I suppose it has a more or less generic URL) and parse it.
您的应用程序需要询问用户的凭据,然后它可以获取联系人备份(我想它或多或少有一个通用的 URL)并解析它。
It will most likely be some form of xml or widely used abook format, both formats meant to be machine readable.
它很可能是某种形式的 xml 或广泛使用的 abook 格式,这两种格式都是机器可读的。
Edit:
编辑:
For Gmail the url is http://mail.google.com/mail/contacts/data/export, it accepts various parameters to define the format of the exported file (gmail csv, vcard, ...) and the scope of exported contacts.
对于 Gmail,url 是http://mail.google.com/mail/contacts/data/export,它接受各种参数来定义导出文件的格式(gmail csv、vcard 等)和导出联系人的范围。
To use it, your application would have to act as a http client and first have to login using the user's credentials.
要使用它,您的应用程序必须充当 http 客户端,并且首先必须使用用户的凭据登录。
回答by bpapa
You may have to screenscrape this yourself, which is a nightmare. I wrote one for Hotmail several years ago that broke after 6 months b/c of changes Hotmail made. And then my fix broke too.
您可能必须自己进行屏幕抓取,这是一场噩梦。几年前,我为 Hotmail 写了一个,但在 Hotmail 进行的 6 个月 b/c 更改后崩溃了。然后我的修复也坏了。

