Working with LinkedIn in XPages – Presenting a User’s Network Stream

Here is another example for accessing LinkedIn’s API’s in XPages. This example contains code for a custom control that will present the users network stream:

<?xml version=”1.0″ encoding=”UTF-8″?>
<xp:view xmlns:xp=”http://www.ibm.com/xsp/core&#8221;
dojoParseOnLoad=”true”>
<xp:this.resources>
<xp:styleSheet href=”/stream.css”></xp:styleSheet>
</xp:this.resources>
<head>
<xp:scriptBlock id=”scriptBlock1″>
<xp:this.value><![CDATA[function loadData() {
// we pass field selectors as a single parameter (array of strings)
IN.API.NetworkUpdates()
.params({type:”SHAR”})
.result(function(result) {
var streamHTML = “”;
for (var update in result.values) {
var thisupdate = result.values[update]

// Build each individual stream update item
person = thisupdate.updateContent.person
var thisHTML = “<div>”;

// Person’s picture, linked name, and status
thisHTML += “<div>” ;
thisHTML += “<img align=’left’ height=’50’ src='” + person.pictureUrl + “‘></a>”;
thisHTML += “<a href='” + person.publicProfileUrl + “‘>”;
thisHTML += “<span>” + person.firstName + ” ” + person.lastName + “</a></span>”;
thisHTML += “<p>” + person.currentShare.comment + “</p></div></div>”;

// Slap this onto the HTML we’re building
streamHTML += thisHTML;
}
dojo.byId(“stream”).innerHTML = streamHTML;
});
}]]></xp:this.value>
</xp:scriptBlock>
</head>
<body>
<div id=”stream”></div>
<script type=”IN/Login” data-onAuth=”loadData”></script>
</body>
</xp:view>

Also here remember to include the LinkedIn domain API key. The result could like something as this:

Applying some oneUI classes could improve the presentation… :-?

About these ads

Born in Holland, current country of residence is Sweden. IBM Notes Consultant since 1997. Main focus is Xpages development. Other interests: computers, motorcycles, music (bass guitar) & cooking.

Tagged with: , , ,
Posted in XPages
4 comments on “Working with LinkedIn in XPages – Presenting a User’s Network Stream
  1. Tim Tripcony says:

    To what does IN.API refer? Is there a client-side JavaScript library you’re using that isn’t reflected in the example markup?

  2. Wasn’t there some stuff in the extlib or was that only for Facebook?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Introduction
I am Patrick Kwinten. I am a IBM Notes Domino Product Specialist since 1996. With this blog I am trying to give my contribution to the community.
.
CV
OpenNTF
Follow my projects on OpenNTF. Below are some examples:

Categories
RSS Feed
Follow

Get every new post delivered to your Inbox.

Join 208 other followers

%d bloggers like this: