A comprehensive web-based tool for monitoring Microsoft Teams user activity and detecting retired & inactive users in your organization.
- Check individual user's Teams presence and activity status
- Real-time presence detection (Available, Away, Busy, Offline)
- Last activity timestamp tracking
- History of recent lookups
- Export results to clipboard
- Advanced scoring algorithm to identify retired employees.
- Single user or bulk analysis (up to 50 users)
- Multi-factor retirement risk assessment including:
- Account status (enabled/disabled)
- Last sign-in activity
- Teams presence and activity
- License assignments
- Group memberships
- Comprehensive step-by-step instructions for Teams management via PowerShell
- Code snippets with copy functionality
- Permission requirements and setup
- Node.js 14.0+
- Microsoft 365 Organization User with Global Reader permissions
- Microsoft Graph API access with appropriate permissions
git clone https://github.com/yourusername/TeamsActivityMonitor.git
cd TeamsActivityMonitor
npm install
# or
yarn install
Copy the .env.example
file to .env
:
cp .env.example .env
Edit the .env
file and add your Microsoft User credentials:
MICROSOFT_CLIENT_ID=your_client_id_here
MICROSOFT_CLIENT_SECRET=your_client_secret_here
MICROSOFT_TENANT_ID=your_tenant_id_here
npm run dev
# or
yarn dev
Open http://localhost:3000 in your browser.
- Go to Azure Portal
- Navigate to Azure Active Directory → App registrations
- Click New registration
- Configure your app:
- Name: Teams Activity Monitor
- Supported account types: Accounts in this organizational directory only
- Redirect URI: Leave blank for now
- Click Register
- In your app registration, go to API permissions
- Click Add a permission → Microsoft Graph
- Choose Application permissions
- Add these permissions:
User.Read.All
- Read all users' profilesPresence.Read.All
- Read presence informationReports.Read.All
- Read usage reportsDirectory.Read.All
- Read directory data
- Click Grant admin consent (requires admin privileges)
- Go to Certificates & secrets
- Click New client secret
- Add a description and select expiry period
- Click Add
- Copy the secret value immediately (it won't be shown again)
From the app overview page, copy:
- Application (client) ID →
MICROSOFT_CLIENT_ID
- Directory (tenant) ID →
MICROSOFT_TENANT_ID
- Your copied secret →
MICROSOFT_CLIENT_SECRET
Go to admin.microsoft.com and sign in.
Left menu: Show all → Roles.
Search Global Reader, open it → Assigned admins. Look for your name.
Or: Users → Active users → open your user → Account tab → Roles → see Admin center access list for Global Reader.
Tip: If you can’t open the admin center, you likely don’t have any admin role (including Global Reader).
- Navigate to
/teams-activity-lookup
- Enter a username or email address
- Click "Lookup" to check their current Teams status
- View presence, activity, and last activity time
- Copy results or check history of recent lookups
- Navigate to
/retired-user-detector
- Choose between:
- Single User: Enter one email address
- Bulk Analysis: Paste up to 50 email addresses (one per line)
- Click "Analyze" to run the detection algorithm
- Review retirement risk scores and recommendations
- Export results to CSV for reporting
- Navigate to
/powershell-guide
- Follow the step-by-step instructions
- Copy code snippets as needed
- Use for advanced Teams management tasks
The tool uses a weighted scoring system to assess retirement risk:
Indicator | Weight | Description |
---|---|---|
Account Status | 30% | Checks if account is disabled or blocked |
Last Sign-in | 25% | Days since last authentication |
Teams Activity | 20% | Recent Teams presence and activity |
License Status | 15% | Active licenses and usage |
Group Membership | 10% | Active directory and security groups |
├── src/
│ ├── app/
│ │ ├── teams-activity-lookup/ # Activity lookup tool
│ │ ├── retired-user-detector/ # Retirement detection tool
│ │ └── powershell-guide/ # PowerShell documentation
│ ├── api/
│ │ └── teams-activity/ # API routes for Teams data
│ └── components/ # Reusable React components
├── public/ # Static assets
└── package.json # Dependencies and scripts
- Frontend: Next.js 14, React 18, TailwindCSS
- API Integration: Microsoft Graph API
- Deployment: Vercel-ready
Check Teams activity for a specific user.
Request Body:
{
"username": "[email protected]"
}
Response:
{
"username": "[email protected]",
"displayName": "John Doe",
"lastActivity": "2024-01-27T10:30:00Z",
"presence": {
"availability": "Available",
"activity": "Available"
},
"timestamp": "2024-01-27T10:35:00Z"
}
- Verify your environment variables are set correctly
- Check that your client secret hasn't expired
- Ensure admin consent has been granted for API permissions
- Verify the email address is correct
- Check that the user exists in your Microsoft 365 tenant
- Ensure you have
User.Read.All
permission
- The tool includes built-in rate limiting for bulk operations
- If you encounter throttling, reduce batch sizes or add delays
For issues, questions, or suggestions, please:
- Open an issue on GitHub
- Contact your organization's IT administrator
- Review the [Microsoft Graph documentation] (https://docs.microsoft.com/en-us/graph/)
This tool is designed for legitimate administrative purposes only. Ensure you have proper authorization before monitoring user activity in your organization. Always comply with your organization's privacy policies and local regulations regarding employee monitoring.
Note: Currently, the tool displays simulated data for demonstration purposes. Connect your Microsoft Graph API credentials to enable real-time Teams activity monitoring.