You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.2 KiB
60 lines
2.2 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Client-Side JavaScript Code Sample</title>
|
|
<script src="/Scripts/3rd/jquery-2.1.3.min.js"></script>
|
|
<script src="/Scripts/lib/Util.min.js"></script>
|
|
<script src="/Scripts/constants.js"></script>
|
|
<script src="//js.live.net/v5.0/wl.js"></script>
|
|
<script src="/Scripts/Test_Calendar.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="signin"></div>
|
|
<label id="info"></label>
|
|
<div>
|
|
<input type="button" id="id1" value="读取日历属性" />
|
|
<input type="button" id="id2" value="删除日历" />
|
|
<input type="button" id="id3" value="创建日历" />
|
|
<input type="button" id="id4" value="更新日历属性" />
|
|
<input type="button" id="id5" value="读取日历事件" />
|
|
<input type="button" id="id6" value="删除日历事件" />
|
|
<input type="button" id="id7" value="创建日历事件" />
|
|
<input type="button" id="id8" value="更新日历事件" />
|
|
</div>
|
|
<script>
|
|
WL.Event.subscribe("auth.login", onLogin);
|
|
WL.init({
|
|
client_id: APP_CLIENT_ID,
|
|
redirect_uri: REDIRECT_URL,
|
|
scope: ["wl.signin", "wl.basic", "wl.birthday", "wl.emails", 'wl.calendars'],
|
|
response_type: "token"
|
|
});
|
|
WL.ui({
|
|
name: "signin",
|
|
element: "signin"
|
|
});
|
|
function onLogin(session) {
|
|
debugger
|
|
if (!session.error) {
|
|
WL.api({
|
|
path: "me",
|
|
method: "GET"
|
|
}).then(
|
|
function (response) {
|
|
document.getElementById("info").innerText =
|
|
"Hello, " + response.first_name + " " + response.last_name + "!";
|
|
},
|
|
function (responseFailed) {
|
|
document.getElementById("info").innerText =
|
|
"Error calling API: " + responseFailed.error.message;
|
|
}
|
|
);
|
|
}
|
|
else {
|
|
document.getElementById("info").innerText =
|
|
"Error signing in: " + session.error_description;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|