Lync presence in SharePoint app part
-
Hi all, I am creating an app part (SharePoint online) where I want to list users while showing their Lync presence. I am retrieving users from a list using CSOM. I found this resource on how to integrate Lync presence: http://www.sharepointcolumn.com/lync-presence-indicators-code-snippets-in-sharepoint-2013/ (I am using DefaultRender). It works perfectly when used as static HTML but I can't get it to work for the list items. I have tried appending html to the div and using Knockout.js. I am using unique ID's for each control as stated in the comments. When I use the exact same html by manually entering sip and id instead of data-bind it works perfectly. But with knockout, it just does not seem to work. sip and id seems correct as far as I can tell. Perhaps there is a better way of achieve Lync presence? Here is the JavaScript:
var ParticipantItem = function (name, sip, id, id2) {
var self = this;
self.Name = name;
self.Sip = sip;
self.Id = id;
self.Id2 = id2;
}function ParticipantListViewModel() {
var self = this;
self.Participants = ko.observableArray();self.AddParticipant = function (name, sip, id, id2) { self.Participants.push(new ParticipantItem(name, sip, id, id2)); nbrOfParticipants = self.Participants().length; }
}
function LoadData() {
completeParticipantList = new ParticipantListViewModel();
GetList();
ko.applyBindings(completeParticipantList);
}function GetList() {
var self = this; var clientContext = SP.ClientContext.get\_current(); var participantList = clientContext.get\_web().get\_lists().getByTitle('Participant Values'); participantItems = participantList.getItems(new SP.CamlQuery.createAllItemsQuery()); clientContext.load(participantItems); clientContext.executeQueryAsync(onParticipantsLoadSucceeded, onParticipantsLoadFailed);
}
onParticipantsLoadSucceeded = function (sender, args) {
var currentItem = participantItems.getEnumerator(); while (currentItem.moveNext()) { var lyncIdString1 = 'imn\_' + currentItem.get\_current().get\_item("ID").toString() + ',type=sip'; var lyncIdString2 = 'imn\_' + currentItem.get\_current().get\_item("ID").toString() + '1,type=sip'; completeParticipantList.AddParticipant(currentItem.get\_current().get\_item("Title"), currentItem.get\_current().get