There are lots of examples around that show how to get a list of current TFS users, but how do I get a list of old users that have commit changes in the past but no longer belong to any security groups?
For the record, this is the code I'm using to find all current users:
var gss = tfs.GetService<IGroupSecurityService>();
var members = gss.ReadIdentity(SearchFactor.EveryoneApplicationGroup,
null,
QueryMembership.Expanded).Members;
return gss.ReadIdentities(SearchFactor.Sid, members, QueryMembership.None)
.Where(identity => identity != null &&
identity.Type == IdentityType.WindowsUser)
.Select(identity => string.Format(@"{0}\{1}",
identity.Domain,
identity.AccountName));
I can't offer an exact answer, but hopefully this will help...
You can list all pending changes through the workspaces (i.e. tf.exe workspaces command and equivalent apis). Using the owner of each workspace with uncommitted changes you should then be able to cross-reference against the list of active users you've already got.