I saw a couple of approaches using the IGroupSecurityService interface that is a part of the Microsoft.TeamFoundation.Server but it has been marked as obsolete and instead a hint is provided to use the better alternative which is IIdentityManagementService. So here is a simple code snippet on how to get a list of team members ordered alphabetically.
Please note that the collection variable is simply an instance of the team project collection class
new TfsTeamProjectCollection(collectionUrl, credentials)
Also note that when developing using the TFS API, you will need the following assemblies and namespaces referenced:
using Microsoft.TeamFoundation;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Framework.Client;
using Microsoft.TeamFoundation.Framework.Common;
among others..
Here is the snippet::