Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top