SharePoint: how to get the user's last logout or last session end date / time

How can I determine the last date / time a user logged in to the MOSS 2007 web application? So far, I have not found this information in the object model.

I already thought that the request lastLogonTimeStamp generates AD / LDAP, but it will be very inaccurate.

Another idea is to write code to store the date / time of entry into the user data list whenever a user logs in. But so far I'm not sure how to do this.

So, does anyone know a better solution?

UPDATE

After several tests and more reflection on my problem, I realized that I really do not need the timestamp of the last login, and the timestamp of the last logout, respectively, at the end of the last session.

As there is now a way to get the timestamp of the last entry through the object model, I can imagine that there is also no way to get the date and time of the end of the last session.

So how can I get this information?

+4
source share
2 answers
  • Extending user information list with LastSessionID, LastSessionTime
  • Add a little webcontrol to your host. This webcontrol updates the list of user data if LastSessionID is different. And adds time.
  • Of course, in RootWeb for the Collection site.
+3
source

Surprisingly, there seems to be no way to get this information using the SharePoint API. However, you can get this information from IIS logs. I think that doing it this way would be more accurate than getting it from AD, because the user can log in without visiting SharePoint.

Another approach would be to use SharePoint auditing. As far as I know, there is no specific login audit event, but you can check when a user reads the SharePoint welcome page. Using SPAuditQuery, you can get some details.

+2
source

All Articles