AI OnAI Off
I suppose you will need to query DB for that (this is pseudo code)..
1) collect all user ids who were loggedin just before your time window of interest
SELECT [intUserID] FROM [dbEPiCoopCommon].[dbo].[tblEPiServerCommunityOnlineStatus] WHERE datLoginDate < '2012-11-28'
2) Loop through and remove those
collectionOfIds.ForEach(id =>
{
CommunitySystem.CurrentContext.DefaultSecurity.RemoveUser(
CommunitySystem.CurrentContext.DefaultSecurity.GetUser(id));
})
You will need to do it on regular basis for sure to remove proper inactive users.
Hi!
I am wondering if there is a smart way to find users who haven't logged in for, say, 1 year and delete these users programatically (Relate 2.0)?
What I've found so far is the OnlineStatusHandler.Instance.GetLastLogin() which takes a user as parameter However getting all users, looping through them and doing this check on each users feels inefficient. I was hoping there would be a way to query users based on their last login?
Thanks!
/Daniel