using (SPSite site = new SPSite(siteUrl))
{
  ServerContext context = ServerContext.GetContext(site);
  UserProfileManager profileManager = new UserProfileManager(context);

  foreach (UserProfile userProfile in profileManager)
    Console.WriteLine(userProfile[PropertyConstants.UserName].Value);
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here