avrei bisogno di inserire i contatti in outlook.com, prelevando i dati da una pagina. Dando un'occhiata alle API di Hotmail ho trovato questo:
codice:
WL.init({ client_id: clientId, redirect_uri: redirectUri });
WL.login({ scope: "wl.contacts_create" }).then(
function(response) {
createContact();
},
function(response) {
log("Could not connect, status = " + response.status);
}
);
function createContact() {
var contact = {
first_name: "William",
last_name: "Flash"
emails:{business:"sdf@asd.it"}
};
WL.api({
path: "/me/contacts",
method: "POST",
body: contact
}).then(
function(response) {
log(JSON.stringify(response).replace(/,/g, ",\n"));
},
function(response) {
log("Cannot create contact: " +
JSON.stringify(response.error).replace(/,/g, ",\n"));
}
);
}
function log(message) {
var child = document.createTextNode(message);
var parent = document.getElementById('JsOutputDiv') || document.body;
parent.appendChild(child);
parent.appendChild(document.createElement("br"));
}
...e direi che funziona alla grande. Non mi è molto chiaro però come posso inserire altri dati tipo la mail e l'indirizzo.
Altra domanda sciocca: come faccio ad inizializzare queste API? io ho provato da quì ma credo ci sia bisogno di mettere un richiamo nell'header.
Bho...spero di non fare troppo la figura del pivello....