Requirement: Find the last login date of a user in SharePoint Online.
How to Get the Last Login Timestamp of a User in SharePoint Online?
To track a user’s activity, we had to find out the last logon. SharePoint doesn’t store the last sign in timestamps anywhere. So, here are the available options:
Option 1: Find the SharePoint Online User’s Last Sign-in Time from Audit Logs
- Login to Microsoft 365 compliance center at https://compliance.microsoft.com
- Click on “Audit” from the left navigation >> Set the date, user, Activity as “User Logged in” and click on the “Search” button.
- This will get you all the Sign-in activities of the selected user.
Option 2: Get Last Login Date from Azure AD Console
The option 2 and option 3 methods discussed here give the login timestamps of an Office 365 user in general – and not specific to SharePoint Online.
- Login to Azure AD console at https://aad.portal.azure.com
- Click on the “Users” from left navigation >> Search and find the target user >> Click on the user name to open user profile page.
- You can see the last sign-in date as highlighted. On clicking the “User Sign-ins” link, you can find all sign-in events of the particular user.
Option 3: Using PowerShell to Get User’s Last Login Date
Use this PowerShell script to get the last login date and time of a specific user. This works for External users as well.
Import-Module AzureADPreview #Connect to Azure AD Connect-AzureAD -Credential (Get-Credential) #Get the Last Login Date and Time Get-AzureADAuditSignInLogs -Filter "userPrincipalName eq '[email protected]'" -Top 1
The Get-AzureADAuditSignInLogs cmdlet comes with AzureADPreview module. So, make sure you have installed it prior to running this script.