如何从链接到我的网页获取连接/朋友信息? [英] How to get connections/Friends information from linked in to my web page?
本文介绍了如何从链接到我的网页获取连接/朋友信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将链接中的连接/朋友信息链接到我的asp.net(在网格视图中)页面?
How to get connections/Friends information from linked in to my asp.net (In Grid View) page?
推荐答案
参考这两个链接
获取LinkedIn登录使用JavaScript API的用户详细信息(名称,电子邮件,网址,个人资料图片) [ ^ ]
Linkedin API for contacts retrieve [ ^ ]
问候......:笑:
Refer these two links
Get LinkedIn Logged in User Details(Name,Email, Url, Profile Image) using JavaScript API[^]
Linkedin API for contacts retrieve[^]
Regards..:laugh:
获取朋友的代码在asp.net页面中描述图片,名称和位置。
步骤1.在 Linkedin <创建API / b>并获得api密钥
注意:必须添加OAuth 1.0接受重定向网址& JavaScript API域(您可以在两者中添加相同的URL)
以获取更多用途链接: http://developer.linkedin.com
步骤2.
在asp.net页面的head标签中编写代码。
Code to get friends Profile Image, name and location in asp.net page.
Step 1. Create API In Linkedin and get api key
note: must add OAuth 1.0 Accept Redirect URL & JavaScript API Domains (you can add same url in both)
for more use link: http://developer.linkedin.com
Step 2.
Write Code in head tag in asp.net page.
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: <Your API ID>
authorize: true
onLoad: onLinkedInLoad
scope: r_basicprofile r_emailaddress r_fullprofile r_network r_contactinfo rw_nus rw_groups w_messages
</script>
<script type="text/javascript">
function onLinkedInLoad() {
IN.Event.on(IN, "auth", function () { onLinkedInLogin(); });
IN.Event.on(IN, "logout", function () { onLinkedInLogout(); });
}
function onLinkedInLogout() {
setConnections({}, { total: 0 });
}
function onLinkedInLogin() {
// here, we pass the fields as individual string parameters
IN.API.Connections("me")
.fields("id", "firstName", "lastName", "pictureUrl", "publicProfileUrl", "location:(name)")
.result(function (result, metadata) {
setConnections(result.values, metadata);
});
}
function setConnections(connections) {
var connHTML = "<ol style='list-style-type:none; vertical-align: middle'>";
for (id in connections) {
connHTML = connHTML + "<li><a href=\"" + connections[id].publicProfileURL + "\">";
/* picture url not always there, must be defensive */
if (connections[id].hasOwnProperty('pictureUrl')) {
connHTML = connHTML + "<img style='width:50px;height:50px' align=\"baseline\" src=\"" + connections[id].pictureUrl + "\"></a>";
} else {
connHTML = connHTML + "<img style='width:50px;height:50px' align=\"baseline\" src=\"http://static02.linkedin.com/scds/common/u/img/icon/icon_no_photo_50x50.png\"></a>";
}
connHTML = connHTML + " <a style='text-decoration:none; color:Blue' href=\"" + connections[id].publicProfileUrl + "\">";
connHTML = connHTML + connections[id].firstName + " " + connections[id].lastName + "</a>";
try {
connHTML = connHTML + " (" + connections[id].location.name + ")</li>";
} catch (e) { }
}
connHTML = connHTML + "</ul>";
document.getElementById("connectionsdata").innerHTML = connHTML;
}
</script>
步骤3:在body标签中写下以下代码
Step 3: write folowing code in body tag
<script type="IN/Login">
<div id="connectionstest">
<h2>
Linked In</h2>
<div id="connectionsdata"></div>
</div>
</script>
保存并运行...
Save and Run...
这篇关于如何从链接到我的网页获取连接/朋友信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文