Windows Live Contacts API Error on Getting E-Mail hashes - JavaScript -


the following codes window live contacts api email address from. works fine in login, log-out, , other authentications. can collect user information of logged in user get data function call, getting email hashes of users, rest of email hashes blank. have 10 email address in contact book.

how email addresses of contacts using api?

<html>     <head>         <script src="https://js.live.net/v5.0/wl.js" type="text/javascript"></script>     </head>     <body>      <a href='javascript:void(0);' onclick='signuserin();'>signuserin</a> <br>     <a href='javascript:void(0);' onclick='signuserout()'>signuserout</a><br>      <a href='javascript:void(0);' onclick='loginstatus()'>check user status</a>      <a href='javascript:void(0);' onclick='getdata()'>get data</a>      <script type="text/javascript" >          wl.init({             client_id: '0000000044444444',             redirect_uri: 'http://domain.com/contact.php',             response_type: "token",             logging: true         });          var scopesarr = ['wl.signin', 'wl.basic', 'wl.emails'];          function signuserin() {             wl.login({ scope: scopesarr });          }          function loginstatus() {             wl.getloginstatus(function(response) {              alert("response " + response );              });         }          function getdata() {             alert( "getdata");              wl.api(                 {                     path: "me/contacts",                     method: "get",                     scope: scopesarr                 },                     function (result) {                          if (!result.error) {                             var resultdata = result.data;                              var emailhashes = new array;                                                 (i = 0; < resultdata.length; i++) {                                  (j = 0; j < resultdata[i].email_hashes.length; j++) {                                     alert( "resultdata " + resultdata[i].email_hashes[j]);                                     emailhashes[emailhashes.length] = resultdata[i].email_hashes[j];                                 }                             }                             var resulttext = "";                             (k = 0; k < emailhashes.length; k++) {                                 resulttext += emailhashes[k] + "\r\n";                                                 }                             // document.getelementbyid("emailhashes").setattribute("rows", emailhashes.length);                             document.getelementbyid("lists").value = resulttext;                         }                         else {                             alert("error getting contacts: " + result.error.message);                         }             });          }          function signuserout() {             wl.logout();         }      </script>      <textarea rows="10" cols="100" id="lists"></textarea>     </body> </html> 

i had same problem , find solution, need add following scope list of scopes you're requesting: "wl.contacts_emails"

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

after did that, had remove application profile reset scope , add second time application. (but if don't want ask people alerady use apps, can reset secret token force user add again app).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -