4

I have a requirement for SharePoint Online users to see what other users are currently online.

Is there a way to achieve this with client-side code? Javascript/jQuery?

  • Out of the box integration with Lync/S4B. The presence indicator shows your S4B status. – Matthew McDermott May 10 '16 at 19:11
8

Extensive explanation, tutorial, etc.: Find Number of Users Currently Logged on to a SharePoint Site

The gist of it is that you don't have OOTB features to show you the number of currently logged in users. You can check IIS for current users, but you don't know whether these are logged on or not. The solution explained in the blog article is to create a delegate control which resides on all pages which counts the number of current sessions. You still don't really have a "live" view as the web is pretty much stateless and it is hard to know whether a user e.g. closed the browser or switched to another tab.

3

Thank you for the answer Hardik.

The topic you linked to seems to be the best and only example of doing this.

Even though, I came up with another solution (an easier version of it), so I am posting it as an answer, in case some other people find it useful in the future :)

What I did:

  1. Created a global List "UsersActivities"
  2. Creted two columns in the list: "User" (person) & "LastActive" (Date&Time)
  3. Added custom javascript to the masterpage to call my function every 5 seconds. My custom function updates the item in the "UserActivities" List where "User" = current user and sets "LastActive" to current time.
  4. In the place where people have to see online users (web part in my case) I've added javascript to get items from "UserActivities" List where now - "LastActive" >= 5 seconds

I didn't post any code, just the logic as it has lots of extra, irrelevant code in my solution.

  • 1
    I am thinking you may also be able to do it if you have Skype turned on and you can see the presence. If this is the case, you might be able to use search results (people) and using jQuery to filter the users with the following classes: ms-spimn-img ms-spimn-presence-offline – Ahmed Mahmoud May 6 '16 at 13:04
  • @AhmedMahmoud the thing is that it's a SharePoint Online environment and some users might not have Office 365 Licenses assigned + some people are accessing it through their mobiles and other devices :) – Gintas K May 6 '16 at 13:06
  • yeah..this is only going to work for licensed and Skype is on – Ahmed Mahmoud May 6 '16 at 13:10
  • i wanna make data of online user's visit's statistics for AMCHART that find your article but here not exist any code! this is more helpfull if you make code or refer to other blog article. thanks – saber tabatabaee yazdi Oct 16 '16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.