English 中文(简体)
Get contact s phone numbers and emails using the Windows Live/OneDrive REST API
原标题:

Has anyone successfully used the Live SDK (also called OneDrive SDK) to retrieve the email addresses and/or phone numbers of an user s contacts ?

The best I have been able to do is the get profiles for a users contacts but it only includes hashed email addresses and no phone numbers, like this for example :

{
  "id": "contact.1e680c06000000000000000000000006",
  "first_name": "James",
  "last_name": "Cameron",
  "name": "James Cameron", 
  "gender": null,
  "is_friend": false, 
  "is_favorite": false,
  "user_id": null, 
  "email_hashes": [ "3972d8781911deba416ecf8e44dcc5f4dae92ab9aac58520bcfa480c31ea38f5", "301e45d554a7978c2a8ef1e662876411dfbca4b89535d2362dff3f6d786366b7" ],
  "updated_time": "2011-07-21T20:31:11+0000"
}
问题回答

All you need to do is add the following scope to your list of scopes you re requesting:

"wl.contacts_emails"

e.g.

WL.login({scopes: ["wl.contacts_emails"]});

Use hidden scopes, not officially supported but I can confirm they currently work at version 5.6 despite the MSDN forums telling you they don t.

For emails use wl.contacts_emails, for phone numbers use wl.contacts_phone_numbers.

As per this document: http://msdn.microsoft.com/en-us/windowslive/hh278351

You can have only emails of contacts that are already in your database. This means that Microsoft wants you to calculate hashes for all of your email addresses in your websites database. Than once you do the contact import you compare your hashes with the hashes they gave you in the response and retrieve FROM YOUR DATABASE the emails that had matching hashes:

Here is original text:

For your website to participate in this scenario, you must create a hash of each email address that belongs to each registered user of your website. Each of these hashes must follow a specific format that the Live Connect APIs recognize. After you have created a hash for each of your registered users email addresses, you can compare your list of hashes with the list of email-address hashes that Live Connect generates for the visiting user s contacts. Each matching hash represents a registered user of your website who is also one of the visiting user s contacts.

The only way to bypass that as far as I can tall is to do website scraping or to figure out how to trigger automatic contact export and just process the exported file.





相关问题
Why does this exception claim the code doesn t write data?

If you run this code it will throw a WebException. The inner exception is "Content-Length or Chunked Encoding cannot be set for an operation that does not write data." and I do not understand the ...

API for Microsoft OneNote 2010 + SkyDrive Web Services?

I am quite familiar with the Microsoft OneNote 2007 and 2010 APIs, however these interface directly with OneNote itself. In 2010 we have the great facility of syncing OneNote with SkyDrive. This works ...

Access Microsoft Live services from Python application

I need to access microsoft skydrive from my python app. Is there a SOAP or REST service that Microsoft provides for developers? If there is no web service, does any python library that allows to ...

Silverlight and skydrive/dropbox

Can You read/write a file in your Skydrive with Silverlight? Or if that isn t possible, can you dot it with Dropbox? thanks, Filip

Problem connecting to OneDrive File Picker v8

I m trying to integrate the OneDrive File Picker v8 API into a SPA project but I keep getting an error in connecting to the picker which I can t decipher. Here s what the error from the popup window ...

热门标签