Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SharePoint
  4. Lync presence in SharePoint app part

Lync presence in SharePoint app part

Scheduled Pinned Locked Moved SharePoint
javascriptsharepointhtmlcomtutorial
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11212036
    wrote on last edited by
    #1

    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
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups